The ROW_NUMBER function returns the ordinal row position of each row in a grouping within a result set. This function...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
can be very useful for generating reports.
select ROW_NUMBER() over(PARTITION BY PC.Name ORDER BY ListPrice) as Row, PC.Name Category, P.Name Product, P.ListPrice From Production.Product P JOIN Production.ProductSubcategory PSC on P.ProductSubCategoryID = PSC.ProductSubCategoryID JOIN Production.ProductCategory PC on PSC.ProductCategoryID = PC.ProductCategoryID
Dig Deeper on Microsoft SQL Server Database Development
Related Q&A from Joe Toscano
Is there a query to search text in a SQL Server DTS package? SQL Server expert Joe Toscano explains which database objects can be viewed.continue reading
Migrate DTS packages to SQL Server Integration Services with Migration Wizard and deploy SSIS packages in SQL 2005. Learn how to access DTS Designer ...continue reading
Getting an error when importing data from an Excel spreadsheet to SSIS in SQL Server 2005? Try lining up data types in Excel and SSIS so they match.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.