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 |
|
silver_atlima
Starting Member
4 Posts |
Posted - 2004-11-01 : 07:56:33
|
| Hi,A fairly silly question but I have no idea how to do this in code.I have this one columned table that only holds sequential numbers.(1,2,3,4,5, etc). I want to populate this table through SQL code and not manually enter all these values in the table.Can anyone help me write this sql query?Thanks!! |
|
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2004-11-01 : 08:21:55
|
| If this number field is set to identity and to increment.you don't need t oinsert the number, it will automatically insert the new record giving it the next number. |
 |
|
|
tran008
Starting Member
38 Posts |
Posted - 2004-11-01 : 08:23:32
|
| look up Identity in BOL |
 |
|
|
silver_atlima
Starting Member
4 Posts |
Posted - 2004-11-01 : 09:01:14
|
| Thanks but I don't need this column to be an identity column. Thanks for the posts. :) I did this:DECLARE @x intSET @x = 1WHILE @x < 1001BEGIN INSERT INTO tempTbl(NUM) VALUES (@x) set @x = @x + 1END |
 |
|
|
|
|
|