July 19, 2010 at 1:13 pm
Hi everybody,
Please help me in auto generating the column value.
Sample Select statement as follows
select
'' as sno,
name varchar(20),
-----
Here I need to auto generate sno, in select statement itself..
I am using SNO for this result only..
Please help me on this, if it is possible
🙂
July 19, 2010 at 1:26 pm
Auto generate it with what data values? Integer values? If so, then you can use the ROW_NUMBER() function if you are using 2005 or 2008.
Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
Ramblings of a DBA (My SQL Server Blog)[/url]
Subscribe to my blog
July 19, 2010 at 1:27 pm
Sorry just noticed you posted in the 7,2000 forum. ROW_NUMBER() function is not available in those. You can join to a tally table to achieve what you want. I'll see if I can get you a link to an example.
Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
Ramblings of a DBA (My SQL Server Blog)[/url]
Subscribe to my blog
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply