Error deleting all tables “DELETE failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'”

后端 未结 1 468
借酒劲吻你
借酒劲吻你 2021-02-06 22:02

I have a script to delete all tables in my database that looks like this:

-- Disable all constraints
EXEC sp_MSForEachTable \'ALTER TABLE ? NOCHECK CONSTRAINT all         


        
相关标签:
1条回答
  • 2021-02-06 22:29

    Add the SET options to the delete call.

    These still apply to the other items mentioned in the error, even though you disabled FKs.

    This will work around any saved or environment settings

    Edit, after comment

    EXEC sp_MSForEachTable 'SET QUOTED_IDENTIFIER ON; DELETE FROM ?'
    
    0 讨论(0)
提交回复
热议问题