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)
 Dyanmic SQL numering in SQL 2000

Author  Topic 

Ranjani
Starting Member

1 Post

Posted - 2005-11-17 : 08:35:35
I have the following requirement

Journ_id Seq_no Line_no
AA 1 1
AA 1 2
BB 2 1
BB 2 2
BB 2 3

Please let me know if there is a direct sql statement without using cursors , triggers or any local variables.

The first seq_no column can be derived using the "identity" concept.
Please provide your suggestions to popualte the Line_no with a single query using aggregate or any functions

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-11-17 : 08:40:25
Homework?

CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-17 : 09:10:02
What is your actual data look like?

Madhivanan

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

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2005-11-17 : 10:08:53
Oh, this DEFINITELY looks like homework. "Please provide your suggestions to popualte the Line_no with a single query using aggregate or any functions" Can we show our work on a separate page if we run out of space?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-18 : 01:53:13
See if point 1 will help you here
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx

Madhivanan

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

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-11-18 : 02:32:03
quote:
Originally posted by blindman

Oh, this DEFINITELY looks like homework. "Please provide your suggestions to popualte the Line_no with a single query using aggregate or any functions" Can we show our work on a separate page if we run out of space?



Either a homework or should had been asked in some interview.

Thanks

Karunakaran
Go to Top of Page
   

- Advertisement -