@Begin int,? set @sStr='select * into ##bb from'+ (@sSql) ——##标识全局临时表,#标识局部临时表
@Ending int
AS
declare @sSql varchar(500),@sStr varchar(500)
set @sSql= '(select * from titles where title_id is not null '
if @Begin ='1'
?set @[email protected]+'and pub_id=''0877'''
if @Ending <>''
?set @[email protected]+'and type=''mod_cook'''
set @[email protected] + ') temp'
exec(@sStr)
select * into #temp from ##bb?
drop table ##bb--一定要销毁全局临时表
详细解决方案
在存储过程中施行SQL字符串并存入全局临时表
热度:93 发布时间:2016-05-05 14:52:01.0
相关解决方案