当前位置: 代码迷 >> Sql Server >> 这个sql有有关问题吗
  详细解决方案

这个sql有有关问题吗

热度:46   发布时间:2016-04-24 09:05:42.0
这个sql有问题吗?
临时表 在多用户同时点击按钮去执行下面语句有问题吗? 高并发的情况下, 是不是临时表的名字要改成用户名+临时表的名字?

if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#temp1'))
drop table #temp1
go
select ID into #temp1 from 
(select  top(1000)  ID FROM Pre_database 
where 状态=1
Order by ID DESC) a
------解决思路----------------------
临时表名倒不会出现问题,SQLSERVER自己会区分不同会话的临时表
  相关解决方案