34,873
社区成员
发帖
与我相关
我的任务
分享
Create table #tb
(id int,
name nvarchar(20))
GO
--1--
if object_id('#tb') is null
drop table #tb
GO
--2--
if not exists (select 1 from sysobjects where xtype = 'u' and id = object_id('temp..#tb'))
drop table #tb
GO
drop table tb --直接删除表
delete from tb --删除表所有数据,有日志
truncate table tb --删除表所有数据,没有日志
if exists (select 1 from sysobjects where xtype = 'u' and id = object_id('temp..#tb'))
drop table #tb
go
