Let's say you need a table that has numbers from 1 to 10.
2set @i=0
3while (@i<10)
4 begin
5 insert into digits (digit) values (@i)
6 set @i=@i+1
7 end
8
9select * from digits
2------
30
41
52
63
74
85
96
107
118
129
13
14(10 row(s) affected)
Lets say you wanted all the letters in a table. Checking www.asciitable.com, we see that A has the ASCII value of 65, and Z has the ASCII value of 90.
2set @i=65
3while (@i<=90)
4 begin
5 insert into letters (letter) values (CHaR(@i))
6 set @i=@i+1
7 end
8
9select * from letters
2------
3A
4B
5C
6D
7E
8F
9G
10H
11I
12J
13K
14L
15M
16N
17O
18P
19Q
20R
21S
22T
23U
24V
25W
26X
27Y
28Z
29
30(26 row(s) affected)
#1 by hollister clothing on 7/19/10 - 2:21 PM
#2 by hollister clothing on 7/19/10 - 2:31 PM
#3 by Abercrombie & fitch uk on 7/23/10 - 11:59 AM
I second albertacowpoke's question...
I hate guns If no guns of everyone,the world maybe well.
Think they would read the BILL if they had to live by it?
#4 by ugg on 7/30/10 - 12:46 AM
#5 by ティンバーランド 通販 on 8/24/10 - 4:32 AM