简体   繁体   English

等效于SQL Server中的TRUNCATE TABLE?

[英]What's equivalent to TRUNCATE TABLE in SQL Server?

I'm looking for something equivalent to TRUNCATE TABLE 我在寻找等同于TRUNCATE TABLE的东西

How I do this using SQL Server 2005? 如何使用SQL Server 2005做到这一点?

Thanks in advance! 提前致谢!

t-sql for sql server 2005: SQL Server 2005的T-SQL:

TRUNCATE TABLE schema.tablename;
GO

link: http://msdn.microsoft.com/en-us/library/ms177570%28v=SQL.90%29.aspx 链接: http : //msdn.microsoft.com/zh-cn/library/ms177570%28v=SQL.90%29.aspx

AFAIK TRUNCATE TABLE works in server 2005 (just tried it to make sure) so just consider this an alternative, but still not sure why you don't want to use it. AFAIK TRUNCATE TABLE可在server 2005中使用(只是尝试进行确认),因此,可以将其视为替代方法,但仍不确定为什么不想使用它。

Did you try 你试过了吗

DELETE FROM TABLE

or 要么

DELETE FROM TABLE WHERE 1=1 --SQL server may warn no expression in the previous one

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM