Solved

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

Posted on 2011-09-06
4
178 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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