一张表tb
字段
f1 是自动增长标识
f2 是CHAR类型
我要做个测试,希望能够循环插入
f1 f2
1 test1
2 test2
3 test3
。
。
。
。
。
求这样一个函数或者说是查询语句。
字段
f1 是自动增长标识
f2 是CHAR类型
我要做个测试,希望能够循环插入
f1 f2
1 test1
2 test2
3 test3
。
。
。
。
。
求这样一个函数或者说是查询语句。
解决方案 »
- 求mssql高效的插入方法
- 关于win7和winXP建立ODBC的问题
- 记录中的字符串相加
- 急!怎样单独安装SQL Server 2008帮助文档?
- 一个简单SQL语句报错 求解!下班结帖
- 这个整合语句怎么写,不要用表别名,因为我是在sybase下面的,好像不支持表别名
- 散分,再问如何删除表中的重复记录?有重复的记录全部过滤
- 关于时间计算的一个疑难问题~
- 怎样在SQL Server7.0中写个存储过程,读取Sybase的表内容?我不熟悉Sybase,没分了
- 高手请进==>我的SQL SERVER2000只要有几台工作站同时访问就会有经常连接不上的问题,但一台连接是肯定没问题的,请问何原因?不断加分...
- 动态sql如何解决传入的值是整型和日期时间类型??
- 怎样判断链接服务器的某数据库是否存在?
set @i=1
while @i<101
begin
insert into tab select 'test'+cast(@i as varchar(4))
end
-- -----------t_mac 小编-------------
---希望有天成为大虾----
-- =========================================IF OBJECT_ID('tb') IS NOT NULL
DROP TABLE tb
GO
CREATE TABLE tb(f1 int identity(1,1) ,f2 varchar(100))
go
declare @f2 varchar(100),@n int
set @n=1
set @f2='test'
while @n<100
begin
insert tb
values (@f2+CONVERT(varchar,@n))
set @n=@n+1
end
select * from tb
go
/*------------
1 test1
2 test2
3 test3
4 test4
5 test5
6 test6
7 test7
8 test8
9 test9
10 test10
11 test11
12 test12
13 test13
14 test14
15 test15
16 test16
17 test17
18 test18
19 test19
20 test20
21 test21
22 test22
23 test23
24 test24
25 test25
26 test26
27 test27
28 test28
29 test29
30 test30
31 test31
32 test32
33 test33
34 test34
35 test35
36 test36
37 test37
38 test38
39 test39
40 test40
41 test41
42 test42
43 test43
44 test44
45 test45
46 test46
47 test47
48 test48
49 test49
50 test50
51 test51
52 test52
53 test53
54 test54
55 test55
56 test56
57 test57
58 test58
59 test59
60 test60
61 test61
62 test62
63 test63
64 test64
65 test65
66 test66
67 test67
68 test68
69 test69
70 test70
71 test71
72 test72
73 test73
74 test74
75 test75
76 test76
77 test77
78 test78
79 test79
80 test80
81 test81
82 test82
83 test83
84 test84
85 test85
86 test86
87 test87
88 test88
89 test89
90 test90
91 test91
92 test92
93 test93
94 test94
95 test95
96 test96
97 test97
98 test98
99 test99
-------*/