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.
| Author |
Topic |
|
dina
Starting Member
1 Post |
Posted - 2006-05-31 : 02:21:59
|
| hai , I want to populate a column in a table with continous numbers starting from 1 to 100 using sql queryAny way to da thatRegardsDina |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-31 : 02:39:51
|
| or if you have a datetime or any column that increments...update table_nameset columnname=(select count(*) from table_name where incrementing_col<a.incrementing_col) + 1from table_name a--------------------keeping it simple... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-31 : 04:24:18
|
| Where do you want to show the data?If you use front end application, do numbering thereMadhivananFailing to plan is Planning to fail |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-05-31 : 06:45:12
|
Another option...--datadeclare @t table (x varchar(10), y int)insert @t (x) select 'this'union all select 'is'union all select 'some'union all select 'data'--calculation - note that this method will not guarantee the orderdeclare @i intset @i = 0update @t set @i = @i + 1, y = @iselect * from @t--resultsx y ---------- ----------- this 1is 2some 3data 4 Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
|
|
|