有关临时表的数据插入
1、把临时表中的数据插入到另一个表中
insert into 表 select * from #temp
2、把一个表中字段复制到临时表中
select * into #temp from 表 where ...
3、本地临时表的名称以单个数字符号 (#) 打头;它们仅对当前的用户连接是可见的;
4、当用户从 SQL Server 实例断开连接时被删除。
5、判断临时表是否存在
create proc temp(@tablename varchar(200))
as
begin
declare @exec varchar(8000)
set @exec='use tempdb
if exists(select * from sysobjects
where id=object_id(''tempdb..'+@tablename+'''))
select ''存在''
else
select ''不存在'''
exec (@exec)
end
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- stra.cn 版权所有 赣ICP备2024042791号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务