--示例
create proc p_qry
@tbname sysname --结果生成的表名,如果已经存在,会自动删除
as
if exists(select 1 from sysobjects where name=@tbname and xtype='U')
exec('drop table '+@tbname)exec('select top 5 id,name into '+@tbname+' from sysobjects')
go--调用
exec p_qry '表'-- 显示结果
select * from 表
go--删除测试
drop table 表
drop proc p_qry/*--测试结果
id name
----------- ---------------------
333244242 by_huikao
349244299 by_huikaobukao
365244356 cj_banji
381244413 cj_rkteacher
1938874024 CreateWinTable(所影响的行数为 5 行)
--*/
create proc p_qry
@tbname sysname --结果生成的表名,如果已经存在,会自动删除
as
if exists(select 1 from sysobjects where name=@tbname and xtype='U')
exec('drop table '+@tbname)exec('select top 5 id,name into '+@tbname+' from sysobjects')
go--调用
exec p_qry '表'-- 显示结果
select * from 表
go--删除测试
drop table 表
drop proc p_qry/*--测试结果
id name
----------- ---------------------
333244242 by_huikao
349244299 by_huikaobukao
365244356 cj_banji
381244413 cj_rkteacher
1938874024 CreateWinTable(所影响的行数为 5 行)
--*/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货