-- SQL 2005 version
SELECT
RowNumber = ROW_NUMBER() OVER (ORDER BY c.LastName ASC)
,c.LastName
,c.FirstName
FROM SalesLT.Customer c
SELECT
RowNumber = ROW_NUMBER() OVER (ORDER BY c.LastName ASC)
,c.LastName
,c.FirstName
FROM SalesLT.Customer c
And the SQL 2000 version:
SELECT
RowNumber = IDENTITY(INT,1,1)
,c.LastName
,c.FirstName
INTO #Customer_RowID
FROM SalesLT.Customer c
ORDER BY c.LastName ASC
RowNumber = IDENTITY(INT,1,1)
,c.LastName
,c.FirstName
INTO #Customer_RowID
FROM SalesLT.Customer c
ORDER BY c.LastName ASC
No comments:
Post a Comment