在删除时报错
delete × from tablenameerror message:
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions.

解决方案 »

  1.   

    truncate table tablename
      

  2.   

    truncate就是删除记录,但是跟DELETE不同在于:
    delete语句是dml,这个操作会放到rollback segement中,事务提交之后才生效;如果有相应的trigger,执行的时候将被触发
    truncate是ddl, 操作立即生效,原数据不放到rollback segment中,不能回滚. 操作不触发trigger.
      

  3.   

    DELETE语句执行删除的过程是每次从表中删除一行,并且同时将该行的的删除操作作为事务记录在日志中保存以便进行进行回滚操作。
    TRUNCATE  TABLE 则一次性地从表中删除所有的数据页并不把单独的删除操作记录记入日志保存,删除行是不能恢复的。并且在删除的过程中不会激活与表有关的删除触发器。执行速度快。