if object_id(N'tempdb..#K_User',N'U') is not null
begin
--删除临时表
DROP Table #K_User
end
--重新创建临时表
select * into #K_User from (select * from Users where UserID=27) as a
--临时表的使用
select #K_User.SerialNumber from #K_User
SQLServer判断临时表是否存在
最新推荐文章于 2024-11-14 11:53:39 发布
本文介绍了一种在SQL中使用临时表的方法。首先检查临时表#K_User是否存在,如果存在则删除该表。接着重新创建临时表#K_User,并从Users表中选择UserID为27的数据插入到临时表中。最后演示了如何从临时表中查询SerialNumber字段。

2228

被折叠的 条评论
为什么被折叠?



