怎么判别某个表是否存在 我在存储过程中使用 drop table T ,通常由于多人同时调用这个存储过程导致出错,请问sql怎么判别表是否存在,再删除,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if exists (select * from dbo.sysobjects where id = object_id(N'[tb]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [tb] 尽量用临时表,这样在并发时才不容易产生错误。create table #temp if exists (select * from dbo.sysobjects where id = object_id(N'[tb]') if object_id('T') is not nulldrop table T 你们误会了巴, 我工作里就遇到 drop 的情况, 当然我用的是表变量。。if object_id('MyTbl') is not null drop table MyTbl select * from sysobjects where xtype='U' and name='[TableName]' 析取范式 conjunctive normal form 的规律 统计问题,先谢谢了!! 请教一个 游标的写法 mssql数据被我批量修改了,如何恢复? MSSQL 2008连接数据库引擎问题 sql server 2000存储过程分页 SQLServer2005 50万记录多个LIKE性能优化 请问一下在SQL中出现的错误 我有个数据库附加不上是为什么,谢谢 很简单的问题,快来看啊!!! 求救,SQL2000只有前几天的备份,用当前的log可以恢复到当前的数据吗? 这个语句如何写
if exists (select * from dbo.sysobjects where id = object_id(N'[tb]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [tb]
drop table T
drop table MyTbl
select * from sysobjects where xtype='U' and name='[TableName]'