Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Existing Table - Column id --> Primary Key - Want to add value -->0

I have an existing table with CrewID as the Primary Key.  I want to add a crew (<-- Unknown Crew -->) with a CrewID = 0.

Any help is greatly appreciated
LJG
0
LJG
Asked:
LJG
  • 2
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
You mean you want to explicitly set the ID. Is it an IDENTITY column?
0
 
stalhwCommented:
just do:
SET IDENTITY INSERT ON
INSERT INTO CrewID (id, name) VALUES (0,'Unknown')
SET IDENTITY INSERT OFF
0
 
LJGAuthor Commented:
Stalhw
Thanks so much - it solved my problem.  

(FYI: Works perfect - but by the way I had to use identity_Insert with an underline between the two words)
0
 
stalhwCommented:
oh yeah sorry forgot the _
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now