SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: How to Insert Values into an Identity Column in SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 08/06/2007 :  08:13:54  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote

Identity columns
are commonly used as primary keys in database tables.  These columns
automatically assign a value for each new row inserted.  But what if you
want to insert your own value into the column?  It's actually very easy to
do.



Read How to Insert Values into an Identity Column in SQL Server

JLibertor
Starting Member

3 Posts

Posted - 08/06/2007 :  16:25:56  Show Profile  Reply with Quote
Oh man! I was JUST looking for this the other day!

I had resported to all sorts of unsavory deeds to get this done. This is a much better solution.

Go to Top of Page

KBM
Starting Member

4 Posts

Posted - 08/21/2007 :  03:26:41  Show Profile  Reply with Quote
I was looking for that as well, no just one more thing and I am home free.

How do you ignore constraints and triggers? The I can upsize my data from access without using the upsizing wizard and have my tables set up correctly right out the gate.
Go to Top of Page

mohit_sme
Starting Member

USA
13 Posts

Posted - 08/22/2007 :  13:07:36  Show Profile  Visit mohit_sme's Homepage  Send mohit_sme a Yahoo! Message  Reply with Quote
Great, this is really useful. DBCC CHECKIDENT is another useful utility to work with IDENTITY columns.

Thanks
Mohit Nayyar
http://mohitnayyar.blogspot.com/

Thanks
Mohit Nayyar
http://mohitnayyar.blogspot.com
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

USA
4137 Posts

Posted - 08/22/2007 :  13:28:39  Show Profile  Visit graz's Homepage  Reply with Quote
KBM, you can disable constraints and triggers but I'm not sure you can ignore them. You'd have to disable them, do the insert and then enable them.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

KBM
Starting Member

4 Posts

Posted - 08/22/2007 :  16:44:05  Show Profile  Reply with Quote
Graz, Can you disable them Globally or do you have to do each one specifically?
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

USA
4137 Posts

Posted - 08/22/2007 :  16:59:31  Show Profile  Visit graz's Homepage  Reply with Quote
You have to do it per constraint as far as I know. I'd go through books online on constraints for more details. There may be an option to ignore constraints buried in BULK INSERT or the SSIS bulk insert task. If there is I don't remember it.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000