| Login

Search this Blog


Links I like to keep around




Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Apr14

Written by:R Teachout
4/14/2008 1:11 PM

First, create the identical table in the "new" database.

Then run something like the following:

SET IDENTITY_INSERT TableName ON;

Use dbname_db;

truncate table TableName;
insert into TableName (FieldListHere)
(select FieldListHere from dbname_2_db.dbo.TableName)

SET IDENTITY_INSERT TableName OFF;

 

Note1: ALL FIELDS MUST BE DEFINED.. a * will not work.
Note2: TRUNCATE TABLE requires certain permissions (see Books Online),  and won't work if the table is referenced by foreign keys. In this case, you can use "DELETE FROM TableName".

Tags:

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel  

Even as a longtime critic of the company, I must admit that Microsoft occasionally flirts with the truth. Well, perhaps 'flirt' is too strong a word. Let's just say Microsoft sometimes honks and waves as it drives by her house.
-InfoWorld Editor Nicholas Petreley, 06-14-99

Inspired by Nina