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)
 Primary Key

Author  Topic 

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-04-05 : 10:59:03

I need to end up with CalID as a primary key identity field?


Drop table dbo.Cal5C

Select Top 673 IDENTITY (int, 1, 1) As CalID ,CLdate,Shift,Schday,Workdate,0 as Job_number_link
into dbo.Cal5C
From CalendarSch
Where CLdate > Getdate()
Order by CLdate



Any Ideas ?

Jim
Users <> Logic

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-05 : 11:06:36
Jim, just use a CREATE TABLE statement. You know better than this. Come on man.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-05 : 11:10:23
Or you can issue the statement that will make CalID the Primary Key after this as follows:

ALTER TABLE Cal5C ADD CONSTRAINT PK_Cal5C PRIMARY KEY (CalID)
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-04-05 : 11:16:48
Yea I know derrick.
But I rairly mess with tables structure via SP.
One of the pitfalls of using GUI.
Geese My brains fried.
Spent all night up with back pains.

Thanks rfrancisco that was what I was After.


Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -