首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql把临时表中的数据安插到另一个表中

2012-09-25 
sql把临时表中的数据插入到另一个表中sql把临时表中的数据插入到另一个表中1、把临时表中的数据插入到另一

sql把临时表中的数据插入到另一个表中
sql把临时表中的数据插入到另一个表中

1、把临时表中的数据插入到另一个表中

insert into 表 select * from #temp

2、把一个表中字段复制到临时表中

select * into #temp from?? 表 where 1=2

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

热点排行