dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Enterprise
Expertise: Beginner
Oct 21, 2002

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Insert Explicit Values into the Identity Column of a Table


For inserting explicit values into the identity column of a table, IDENTITY_INSERT property is set to ON.
 
Table tblName has got following fields
CompanyID INT IDENTITY(1,1)
CoName VARCHAR(75)

And following the data:
 
CompanyID	CoName
1		Starcraft Corporation
2		Holobeam Inc
3		OnSpan Networking Inc
4		CaminoSoft Corp.
5		OMNI Rail Products Inc

Inserting rows with explicit value for CompanyID

SET IDENTITY_INSERT tblName ON

INSERT INTO tblName(CompanyID,CoName) 
VALUES(10,' Globix Corporation')
INSERT INTO tblName(CompanyID,CoName) 
VALUES(6,'Teltone Corp')

After these insertions, the current identity value for the table tblName will be 10.
Ajit Kumar
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date