SQLUSA

Microsoft SQL Server 2005 Best Practices

Microsoft SQL Server 2000 Best Practices

How to apply identity for row sequencing?

 

The following sample will insert JobNumber as identity starting at 100 incrementing 1 into the column list:

 

USE pubs

SELECT EmployeeNumber = emp_id,
FirstName = fname,
MiddleInitial = minit,
LastName = lname,
JobNumber = IDENTITY(smallint, 100, 1),
JobLevel = job_lvl,
PublicationID = pub_id,
HireDate = convert(char(10),hire_date,112)
INTO #Employee
FROM employee
ORDER BY LastName, FirstName
GO
SELECT * FROM #Employee
GO


The Best SQL Server Training in the World
The future is just a click away! Your Future!
SQLUSA.com Home Page