Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Rownumber generation?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-01 : 12:37:57
Mahesh writes "I got your email id from sqlteam.com. I have one question for u. Can you
tell me, how to generate serial number in sql query (SQL Server) (like in
Oracle, ROWNUM is there, which returns the rownumber. Similarly to this,
does SQL server have any function, etc, which will return the row numbers?

Thanks in advance, "

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-02 : 01:53:00
Use column that has identity property

Create table test(i int identity(1,1),n varchar(100))
Insert into test(n) select 'Test' union all select 'More tests'
Select * from test

If you want to number the result set use front end application to do that


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-02 : 01:59:35
In SQL 2005 there is function called ROW_Number()

And if you are using SQL 2000 then refer the following link
http://www.sqlteam.com/item.asp?ItemID=1491

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page
   

- Advertisement -