sqlserver2005判断临时表是否存在

Way 1 if(exists(select name from tempdb..sysobjects where name like'%temptab%' and type='U'))    drop table #temptab Way 2  www.2cto.com  if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempcitys') and type='U')    drop table #tempcitys Way 3 IF OBJECT_ID('tempdb..#') IS NOT NULL    DROP TABLE # OBJECT_ID此函数返回数据库对象标识号 判断数据库里有没有存在PerPersonData这样一张表 if exists (select * from sysobjects where objectproperty(object_id('PerPersonData'),'istable') = 1) OBJECTPROPERTY:返回当前数据库中对象的有关信息。1表“真”。同样可以写成OBJECTPROPERTY(id,isUserTable) = 1  www.2cto.com  if exists (select * from sysobjects where id = object_id(N'PerPersonData') and OBJECTPROPERTY(id,N'IsUserTable') = 1) drop table 'PerPersonData' 判断试图是否存在 if exists (select * from sysobjects where id = object_id(N‘[dbo].[ESTMP]‘) and OBJECTPROPERTY(id,N‘IsView‘) = 1)   drop view ESTMP 转自:http://www.2cto.com/database/201209/157718.html

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...