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
.
Saturday, March 29, 2008
Add Serial Number to Our Query Result
Subscribe to:
Post Comments (Atom)
1 comment:
hey! thanks a lot... this worked for me. You really made it worked.
God Bless you
Post a Comment