Friday 12 April 2013

what is an Identity in Sqlserver?

Identity :
                        Identity is used to generate serial numbers for a column in  a table.
syntax  : 
                      identity(seed,incr)    (incr nothing but increment)


 what is seed :  seed is start with
                                                  optional
                                                   default1
what is incr :   increment by value
                                               optional
                                                default1


example :           
  • create table  emp (empno int identity(100,1),ename varchar(50))
  •  insert into emp values('a')

No comments:

Post a Comment