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
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Copying set of tables

Author  Topic 

georgij1986
Starting Member

12 Posts

Posted - 2008-10-28 : 03:12:41
I have 2 databases, real database on server X(named X1).
And database for testing on my local computer(database name X1).
X1 on local computer is copy from server.
I change many tables in my test database version (about 50).
I must copy content of this 50 table.
(I can't copy all database, because pending time, when i was
working on local computer, real database(except that 50 tables, that I want to copy) was change.
So... there are many links(foreign key, primary key) between this tables and other tables from database.
I can't drop all of them and create over again.
I want something about this:

delete from [server].[real].[dbo].[x1_table]
SET IDENTITY_INSERT [real].[dbo].[GROUPS]ON
INSERT INTO [server].[real].[dbo].[x1_table]
SELECT * FROM [test].[dbo].[x1_table]
SET IDENTITY_INSERT [real].[dbo].[GROUPS]OFF

for all x2...x50 tables.
But there is problem, I can't delete data from x1 table
(foreign keys, primary keys, links between other tables)
I can't Insert into [server].[real].[dbo].[x1_table].
error:
Explicit value must be specified for identity column in table '...' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.
or some times error:
An explicit value for the identity column in table 'TEST.dbo.GROUPS' can only be specified when a column list is used and IDENTITY_INSERT is ON.
What can I do?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-28 : 03:47:14
Try copying all the data from your test db to server db using export import wizard with enable identity insert property selected.
Go to Top of Page
   

- Advertisement -