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 2000 Forums
 SQL Server Development (2000)
 "Auto-Generated" Identities

Author  Topic 

decapolo
Starting Member

15 Posts

Posted - 2005-12-28 : 00:19:01
Hi ...

I need to transfer data from the client-side to the server side in a way such that the auto-generated values for the primary keys of the tables remain intact. But the tables on my server-side also have auto-generated primary keys.

So is there a way to remove the 'auto-generated' IDENTITY constraint for a table using T-SQL statements? and then reinstate the constraint when required?

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-28 : 00:32:38
Use
SET IDENTITY_INSERT <Table Name> ON
now you can add values for identity columns

SET IDENTITY_INSERT <TableName> OFF
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-28 : 00:55:14
And there are changes of duplicate values if you use the above method

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

decapolo
Starting Member

15 Posts

Posted - 2005-12-28 : 01:01:20
hey thanks a lot ... it worked ...

regardz,
sAm
Go to Top of Page
   

- Advertisement -