Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Insert statement, refer identity

Author  Topic 

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-09-10 : 00:07:12
DECLARE @tempfun TABLE(col1 INT IDENTITY(1,1), col2 INT)
DECLARE @tempfunchild(colx INT IDENTITY(1,1), col1 INT, col3 INT)

nows the problem....how to insert @tempfunchild with col1 refering to insert statement of @tempfun


Hope can help...but advise to wait pros with confirmation...

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-10 : 00:15:06
Hi,
declare @id int
insert into @tempfun ( col2 )
select ---------------

select @id = scope_identity()

insert into @tempfunchild ( col1,col3)
select @id, ------
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-09-10 : 01:19:21
thx nages


Hope can help...but advise to wait pros with confirmation...
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-10 : 01:42:24
quote:
Originally posted by waterduck

thx nages


Hope can help...but advise to wait pros with confirmation...



Welcome
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-10 : 01:56:38
for your reading pleasure http://www.sqlteam.com/article/alternatives-to-identity-in-sql-server-2000


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -