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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 identity
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1433 Posts

Posted - 01/04/2012 :  06:05:06  Show Profile  Reply with Quote
Hi,
I am inserting several records into a table which has an identity field. Then I would like to take the inserted batch with the identity values and then insert them into another table.
Question:
How can I take the batch from the table which has the identity column?
Thanks

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/04/2012 :  06:11:55  Show Profile  Reply with Quote
you have to make use of composable DML like below or use a temporary table with OUTPUT clause

http://visakhm.blogspot.com/2011/08/multiple-table-insertion-using-single.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arkiboys
Flowing Fount of Yak Knowledge

1433 Posts

Posted - 01/04/2012 :  06:18:22  Show Profile  Reply with Quote
thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/04/2012 :  12:30:55  Show Profile  Reply with Quote
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 01/04/2012 :  13:21:40  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Water Closet?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000