Jul 10, 2013

Identity in SQL server

7/10/2013 03:38:00 AM

Identity:

Creates an identity column in a table. This property is used with the CREATE TABLE in increment values.

IDENTITY [ (seed , increment) ]

It can be used identity values to off or on.

SET IDENTITY_INSERT Test on

SET IDENTITY_INSERT Test on

 create table Test(Id int identity(1,1))
 insert into Test  DEFAULT VALUES

 create table Test1(Id int identity(1,1))
 alter table Test Add name varchar(20)
 insert into Test (name)values('munish')




DBCC CHECKIDENT

DBCC CHECKIDENT (Test, RESEED, 0)
DBCC CHECKIDENT (Test, NORESEED)


Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

Recent Posts
Popular Articles

 

© 2013 MUNISH ORACLE DBA& .Net Developer. All rights resevered. Designed by Templateism

Back To Top