Sometimes, we need to add serial number in our query result to show on the report. I’m not sure SQL 2000 has this feature or not but I never use that feature in SQL 2000. :D In SQL 2005, we’ve one function call ROW_NUMBER(). So we can display serial number in our query result. The example for that function is as follow:
SELECT ROW_NUMBER() OVER(ORDER BY customername) FROM customer WHERE customername LIKE ‘John%’
You can see detail description of this function at Microsoft MSDN Online
.
Showing posts with label Add Serial Number to Our Query Result. Show all posts
Showing posts with label Add Serial Number to Our Query Result. Show all posts
Saturday, March 29, 2008
Add Serial Number to Our Query Result
Subscribe to:
Posts (Atom)
