"Per" <pe************************@cgey.com> wrote in message
news:e8**************************@posting.google.c om...
I want to insert values into a table and the same time select a value
from the same table.
I insert a record of a parent type and use a function to create a
subscriberType for the record.
Next i insert a record of child type and want to select the
subscriberType from the parent record.
This do not work when i use
INSERT TABLE
SELECT ,Name
,"function to generate subscribertype"
,.............
I DO NOT WANT TO USE CURSOR!!
It's not clear how you create the subscriberType. If it's based on the
properties of the parent record, then you may be able to generate the type
before doing any of the INSERTS:
declare @type int
set @type = dbo.GenerateType(ParentName)
insert into dbo.MyTable
select ParentName, @type
insert into dbo.MyTable
select ChildName, @type
But that's just a guess - without more information (table structure, how you
generate the type etc.), it's not possible to give a better answer.
Simon