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 |
flamz
Starting Member
21 Posts |
Posted - 2008-05-22 : 16:19:43
|
HI,I'm trying to perform a SQL SELECT INTO from one database to another, like this:SELECT * INTO TheTable FROM otherdb.dbo.TheTable.But I get an error saying that the object "TheTable" already exists.I need to first create the table that will be filled with data because the SELECT INTO doesn't copy the IDENTITY property of my ID columns.Any ideas?? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-22 : 16:22:12
|
SET IDENTITY_INSERT TheTable ONINSERT INTO TheTable (Column1, Column2)SELECT Column1, Column2FROM otherdb.dbo.TheTableSET IDENTITY_INSERT TheTable OFFTara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
|
|