manju_gallivant
Old Hand
Points: 384
More actions
March 10, 2009 at 12:01 am
#95109
Hi ..
Can you please provide examples on how to use rownum on a result set which is output of two different tables join ..
RBarryYoung
SSC Guru
Points: 143329
March 10, 2009 at 12:51 am
#956592
Like this:
Select o.object_id
, c.column_id
, o.name
, c.name
, ROW_NUMBER() OVER(Order By o.object_id, c.column_id) as RowNum
From master.sys.system_objects o
Join master.sys.system_columns c
ON c.object_id = o.object_id
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply