delete 表名 --你的老大会经常教训你不要delete后面不加条件的回复我 delete 表名 where 条件 --这样你老大菜敢让你做事情
SP_MSFOREACHTABLE 'TRUNCATE TABLE ?' 清空库中所有表的快捷语句
--单表删除 DELETE table_name WHERE 条件--多条联合删除(注意,还是只能删除一个表中的数据) DELETE A FROM table_A A INNER JOIN table_B B ON A.id = B.id
if OBJECT_ID('[T]') is not null drop table T create table T( id int) insert into T select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union allselect * from T delete T from T where id not in (2,5) select * from T drop table T
DELETE table_name
WHERE 条件--多条联合删除(注意,还是只能删除一个表中的数据)
DELETE A
FROM table_A A
INNER JOIN table_B B
ON A.id = B.id
效果是清空Users表
并且不会写入日志
DELETE TABLE按完整方式记录到日志。
delete 表名 where 条件 --这样你老大菜敢让你做事情
清空库中所有表的快捷语句
DELETE table_name
WHERE 条件--多条联合删除(注意,还是只能删除一个表中的数据)
DELETE A
FROM table_A A
INNER JOIN table_B B
ON A.id = B.id
create table T( id int)
insert into T
select 1 union all
select 2 union all
select 3 union all
select 4 union all
select 5 union all
select 6 union allselect * from T
delete T from T where id not in (2,5)
select * from T
drop table T
truncate table tableName
delete from tableName