Script Primary Key Problem
Hi all :wave:
I am making my database script using script wizard of microsoft sql server 2005.
I set option Script Primary Key=flase
Now I run this script on my main server and then export data. Problem is this that how I can set again primary key on sever databse.
If I set option Script Primary Key=true then my primary key data start from 1,2,3... and data export will not work correctly.
Hope you people got my problem exactly.
Suppose I have data in table
ID Name
11 Shakti
12 Rahul
if Script Primary Key=true then after exporting data will change into
ID Name
1 Shakti
2 Rahul
if Script Primary Key=false then data will transfer correctly bu how I can set primary key again on ID
I have 257 tables in my database
Thanks
Re: Script Primary Key Problem
Can you just create the primary key code, and execute it?
Code:
ALTER TABLE [IdName] ADD CONSTRAINT [PK_IdName] PRIMARY KEY CLUSTERED
(
[ID] ASC
) ON [PRIMARY]