欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SQLServer 循环批处理

程序员文章站 2023-12-10 19:37:58
下面方法可以用来快速生成一批数据 if(object_id('t') is not null) drop table t go create table t(id int...
下面方法可以用来快速生成一批数据

if(object_id('t') is not null) drop table t
go
create table t(id int identity(1,1),name varchar(40))
go
insert into t(name) select newid()
go 10
select * from t
/*
1 18c1c418-9029-4599-8d5e-616354a113c8
2 a0fe1177-09d8-4c56-9fb5-c2faff0155cf
3 9033e8bb-b9a4-4a08-83d8-40064ab68c5f
4 a179a300-e30b-42bf-974e-50928eb7dcf1
5 c1d36d3b-c4d7-431b-8c81-95c9ef9061a0
6 8a99066a-7993-4c06-9763-482c0bf5e687
7 2f0664a8-f91d-4bde-ba0b-48624137b7ca
8 74c3fed3-6182-4ed9-9bfe-9c3dec662f35
9 4e7a8cc8-d7ce-4a0d-8562-688fb3f91458
10 ec82bd91-20b3-46c1-b7cc-c4a8a9099376
*/