sql server - tsql identity insert without column name list -


I am going to dump some data from one DB to another. I am using

  Set my identity_inert Go to MyTable, insert in MyTable * source.dB.dbo.MyTable GO set identity_insert Close MyTable  

Anyway to get it to work? There are 30 tables and it takes time to add a list of column names in the included statement. I am using SQL Server 2000. Upgrade to SQL Server 2008 in the near future.

Edit: MyTable has an identity column.

Drag and drop just the column names from the object browser. One step you can do is take 1 second longer to choose from * and you should never select * in the output code. This is a bad practice.

I'm worried about putting an identity column about you, though, it's something that should never be nearly done. What if there were some identification columns in the original table that are similar to the IDs in the new table? Be sure to check it before deciding to insert the ID values ​​from another table. I like to include in the parent table and get a new ID and it is found in the old ID (good for output 2008) and then use the new ID for any hair tables, but join the old ID .


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -