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
 General SQL Server Forums
 New to SQL Server Programming
 Row Number

Author  Topic 

derach2000
Starting Member

37 Posts

Posted - 2010-05-10 : 04:21:10
Hi,

I need a way to get a row number in te query result.

I have a temp table that is populated with data for a certain user. I cant use identity and truncate metod, becouse there can be many users using it and cause a big problem.
So, the data, before insert, is being deleted for a certain user. Then the new data will bi inserted, and I need a row number.

I'm using SQL2000 right now, so I cant use ROW_NUMBER() function.
So what should I do, use trigger after insert or use #Temp with identity column, or is there another way.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-05-10 : 04:37:36
Refer this

http://senthilnagore.blogspot.com/2009/07/create-row-number-or-serial-no.html

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-10 : 04:48:16
Where do you want to show data?
If you use front end application, do numbering there

Madhivanan

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

derach2000
Starting Member

37 Posts

Posted - 2010-05-11 : 05:02:01
Hi,

Numbering is needed in the database, becouse the application depends on it.
I have implemented a scenario with a #Temp table and identity column, for now.
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-05-11 : 05:02:55
quote:
Originally posted by derach2000

Hi,

Numbering is needed in the database, becouse the application depends on it.
I have implemented a scenario with a #Temp table and identity column, for now.




Have you check my previous post?

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

derach2000
Starting Member

37 Posts

Posted - 2010-05-11 : 09:19:51
Hi,

very interesting. You count the elements. I'll have to check which one of thees method is faster.
Go to Top of Page
   

- Advertisement -