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.
Author |
Topic |
helpme
Posting Yak Master
141 Posts |
Posted - 2011-08-16 : 08:12:49
|
i have to copy some tables from one db to another. The tables have identity columns in them. Is there an easier way thanset identity_insert table_name oninsert into table_name (column1, column2) select column1, column2 from otherdatabase.table_nameset identity_insert table_name offfor non identity column tables, we just do a insert into table_name select * from otherdatabase.table_name |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-08-16 : 08:17:03
|
That is probably by far the easiest way. Anything else I can think of are so convoluted that you don't wanna hear it. If you have a lot of columns and you are concerned about typing all those columns: You can right click on the table in SSMS object explorer, select script table as -> select to -> new query editor window to get you a template to start with. |
 |
|
|
|
|