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
 General SQL Server Forums
 New to SQL Server Programming
 Is there any way to disable the primary key ..?

Author  Topic 

mageshks
Yak Posting Veteran

59 Posts

Posted - 2007-02-24 : 00:56:55
Hi,

Is there any way to disable the primary key constraint?.I want to move the records from one table to another.say column 'x' in the source table doesnt contain a primay key.But my target table column 'x' contains primay key.
How to ovecome this problem?
Thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-24 : 01:20:38
You can disabled it but what do you want to do after you have inserted these duplicated data into the target table ?


KH

Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-02-25 : 07:16:15
Is it a indentity column, which you want to disable?? then the following is the code

SET IDENTITY_INSERT products ON
<YOUR INSERT CODE>
SET IDENTITY_INSERT products OFF

but if you are looking for Disabling the primary key then its not the great idea.. since you have duplicate data then you wont be able set that column as primary key..


Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -