CREATE proc create_erp_table @tabname varchar(255)
as
begin
exec('if object_id('+@tabname+''') is not null drop table '+@tabname+' select * into '+@tabname+' from temp_'+@tabname)
exec('truncate table temp_'+@tabname)
end
GOexec create_erp_table 'product'
到底哪里多了个引号?
为什么老是提示字符串 ') is not null drop table ad_product select * into ad_product from temp_ad_product' 之前有未闭合的引号。
服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: ') is not null drop table ad_product select * into ad_product from temp_ad_product' 附近有语法错误。
as
begin
exec('if object_id('+@tabname+''') is not null drop table '+@tabname+' select * into '+@tabname+' from temp_'+@tabname)
exec('truncate table temp_'+@tabname)
end
GOexec create_erp_table 'product'
到底哪里多了个引号?
为什么老是提示字符串 ') is not null drop table ad_product select * into ad_product from temp_ad_product' 之前有未闭合的引号。
服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: ') is not null drop table ad_product select * into ad_product from temp_ad_product' 附近有语法错误。
解决方案 »
- SQLServer 查找单条记录
- SQL2008中条件语句的问题
- sql查询语句
- 安装sql server2000个人版的时候遇到的问题 Process Exit Code: (-1) 急!!!!附日志
- 简单的问题
- SQL SERVER 7.0中如何创建支持行级锁的表?
- SQL2000中数据分类后取每类数据前4项出问题
- 急!!!!!!!!!!!!!!各位高手帮忙看看这是怎么回事
- 在sql server中能否设置当一个表在被访问时,其他人不允许访问该表
- 关于存储过程创建的全局临时表问题
- 一行记录拆分三行记录
- 数据表设计问题,一个电表一天96个数据,有200-300个电表,是横着搞96列好呀,还是坚着做一列好呢?
exec('if object_id('+@tabname+') is not null
drop table '+@tabname+'
insert '+@tabname+' select * from temp_'+@tabname)