RSS

Creating Negative Identity Column

We can creating the Negative Identity Column in SQL server
- We can create a nagative Identity and the negative seed values for the the Identity column.


Create Table Emp
(
RecID int Not NULL IDENTITY (-100,-1),
Name Varchar(30)
)

-- To insert the value to Table:
Insert into EMP(Name)
SELECT 'Siva'
Union ALL
SELECT 'Kannan'
Union ALL
SELECT 'Krishna'
Union ALL
SELECT 'Devi'
Go
SELECT * FROM EMP


Result
------
-100 Siva
-101 Kannan
-102 Krishna
-103 Devi

0 comments:

Post a Comment