Solved

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

Posted on 2011-09-06
4
177 Views
Last Modified: 2012-05-12
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
Comment
Question by:LJG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36490157
You mean you want to explicitly set the ID. Is it an IDENTITY column?
0
 
LVL 8

Accepted Solution

by:
stalhw earned 500 total points
ID: 36490226
just do:
SET IDENTITY INSERT ON
INSERT INTO CrewID (id, name) VALUES (0,'Unknown')
SET IDENTITY INSERT OFF
0
 
LVL 2

Author Comment

by:LJG
ID: 36490541
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
 
LVL 8

Expert Comment

by:stalhw
ID: 36490585
oh yeah sorry forgot the _
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question