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)
 Rownum against each row

Author  Topic 

RoyalSher
Yak Posting Veteran

95 Posts

Posted - 2006-02-09 : 08:36:37
Hi,

I have a function GenRows() which generates row nums, and I have a table with 1000 rows, Tab A.

Syntax: Select RowNum from GenRows(1000) - Generates row nums
Syntax: Select c1, c2, c3 from Tab A

Here I need to attach each row num against each row in the final resultset.

Unfortunately, the function I am using is a Table Inline view, which returns table with row num values and I don't have any matching column between GenRows (which wouldn't obviously being a function).

I just need a resultset looking like

RowNum C1 C2 C3
1 A B C
2 C A B
3 B C A


Can somebody help me on how to resolve this, so that I can have peaceful weekend :(. Thanks in advance!



RoyalSher.
*********
The world is the great gymnasium where we come to make ourselves strong.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-09 : 08:46:07
Refer to here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6195

----------------------------------
'KH'

everything that has a beginning has an end
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-09 : 08:47:41
this is that article Returning a Row Number in a Query

----------------------------------
'KH'

everything that has a beginning has an end
Go to Top of Page
   

- Advertisement -