www.diy567.com累了,去上面休息一下下,QQ空间,美文,非主流,网络日记,搞笑短信,祝福短信,热门短信,有意思啊
if object_id('tb') is not null drop table tb
go
create table tb(name varchar(50),cnt int)
go
set nocount on
declare c cursor for
select name from sysobjects where type='u' order by name
open c
declare @tb varchar(255)
fetch next from c into @tb
while @@fetch_status=0
begin
exec('insert tb select '''+@tb+''' name,count(*) cnt from ['+@tb+'] having count(*)<>0')
fetch next from c into @tb
end
close c
deallocate c
set nocount off
select * from tb
本文介绍了一个可供人们放松的网站,并附带了一段SQL脚本,该脚本用于创建表格并填充数据。虽然主要内容与信息技术不直接相关,但提供的SQL脚本展示了如何在数据库中创建表并使用游标进行数据填充。
26万+

被折叠的 条评论
为什么被折叠?



