OBJECT PROPERTY AND COLUMN PROPERTY TO CHECK PRIMARY KEY AND IDENTITY COLUMN  IN SQL SERVER 2005

IF OBJECTPROPERTY ( OBJECT_ID(’employee’) , ‘TABLEHASPRIMARYKEY’ ) = 1
PRINT ‘Yes’

IF COLUMNPROPERTY ( OBJECT_ID(’employee’) , ‘id’, ‘IsIdentity’ ) = 1
PRINT ‘Yes’

Pawan Kumar

Pawankkmr@hotmail.com

Advertisements