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
 General SQL Server Forums
 New to SQL Server Programming
 Default value

Author  Topic 

BendJoe
Posting Yak Master

128 Posts

Posted - 2009-01-26 : 09:44:00
I am inserting a row into a table. There is an ID field and another field called createdby I need this created field to have the ID field which is an identity column.How is it possible. I hope the question is clear.
Thanks

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-01-26 : 09:53:00
[code]insert into table1 (createdby,........)
select ID,.... from table2[/code]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-26 : 10:02:05
if you want it to be identity field you dont need to explicitly insert value for it.just make it identity while declaring and exclude it in insert & select list. it will get value automatically.
Go to Top of Page
   

- Advertisement -