sql server如何复制表结构?? select top 0 * into 新表 from 旧表或select * into 新表 from 旧表 where 1=2 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * into [200309] from [200308] where 1=0 select * into [200309] from [200308] where 1=0 select * into 新表名 from 表1 where 1=2 select * into [200309] from [200308] where 1=0 select top 0 * into 新表 from 旧表还有就是用DTS declare @ym char(6)set @ym = select convert(char(6),getdate(),112) ----200309exec('Select * into ' + @ym + ' from 上月表 ') select * into 新表名 from 表1 where 1=2select top 0 * into 新表名 from 表1 还有dts都可以 创建该月报表前,我要先判断是否存在该月报表,如果已有,刚提示已经生成!是否覆盖,如果覆盖的话,刚应该删除该数据表,重新生成之。请问:1、如何判断该表是否存在2、用vb.net语言怎么实现? 具体语言不清楚,结构应该是这样的吧。if exists(select 1 from sysobjects where name='表名' and type='U') 提示已经存在,是否覆盖end ifif 覆盖 drop 表名 select * from 旧表名 into 新表名 where 一个不存在的条件end if sql怎么转换2列的数据? 在SQL2005中, 仅一条SQL语句,在服务器端执行的时间为0秒,在客户端,却要4秒中,为啥这慢哈? 为了提高查询速度,这些字段都要建立索引吗?? 各位高手,快过来看看了 怎样让数据库生成流水号 求Sql:把当前记录保存到另一结构相同的表中 两个sql问题 触发器相关---在线等待---解决了就结贴!!!! 寻求sql2000占用资源的解决方法----解决后开贴给1000分 大力,非常感谢,但还是有点问题请教! 关于多表查询!大家帮帮忙,工程马上就收尾了,这还没弄懂 dbo的疑问
set @ym = select convert(char(6),getdate(),112) ----200309
exec('Select * into ' + @ym + ' from 上月表 ')
select top 0 * into 新表名 from 表1
还有dts都可以
是否覆盖,如果覆盖的话,刚应该删除该数据表,重新生成之。
请问:
1、如何判断该表是否存在
2、用vb.net语言怎么实现?
if exists(select 1 from sysobjects where name='表名' and type='U')
提示已经存在,是否覆盖
end if
if 覆盖
drop 表名
select * from 旧表名 into 新表名 where 一个不存在的条件
end if