[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • 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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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