我要写个存储过程,里面要用到临时表,但临时表的结构是变化的。是随着传入参数table name改变而改变的。我应该怎么做?谢谢大家。急
解决方案 »
- sql 语句获取表字段怎么过滤掉字符属性是自增字段的
- sql merge 中的output怎么用?
- 问存储过程存入不确定个数的值,后逐一处理的方法!
- 没用过存储过程,下面的asp代码用存储过程怎么写?
- SQL SERVER 2008 R2数据恢复问题
- 求数据库表改名的Transcat-sql语句?没分了请只有十分,请帮帮我,谢谢
- 问下存储过程中使用case end以及字符串连接是否会影响查询效率
- 三表内联接问题,在线等待
- 我在数据导入的时候,导入了好多空行都是<NULL>,怎么样吧他们删掉.谢谢!
- 这样的游标有什么错误,高手请进!!!
- sql中怎么取模啊?
- 存储过程中如何按变量值建表(create table)
exec('create table '+@table+'(字段)')
if object_id('tmp') is not null
drop table tmp
exec('select * into tmp from '+@table)
if object_id('tmp') is not null
drop table tmp
exec('select * into tmp from '+@table+' where 1<>0')
临时表结构可以这样
if object_id('tmp') is not null
drop table tmp
exec('select * into tmp from '+@table+' where 1=0')