Microsoft SQL Server 2005 Best Practices

How to sequence credit cards using ROW_NUMBER?

 

Execute the following script in Query Editor to create a sequence named RowNo as an output column for listing credit card ids for the Sales Department:

USE AdventureWorks;

SELECT ROW_NUMBER() OVER (ORDER BY CreditCardID) AS RowNo,
ContactID, CreditCardID
FROM Sales.ContactCreditCard
WHERE YEAR(ModifiedDate)=2005



 

The World Leader in SQL Server Training
 
SQLUSA.com Home Page