用惯了delete语句是delete from tablename where ....

今天要强制使用某一个index,查了查sql server也可以像ORACLE一样用hint,在select语句中是

select * from tablename with(index(indexname)) where...

可在delete中用

delete from tablename with(index(indexname)) where ...

出错。Google了很久终于找到一篇:

http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/32121714-97d8-4c92-8214-ecea4e7dc76a

原来要用

delete tablename from tablename with(index(indexname)) where ...

特此记录。