-1

我在 C# 中有以下代码:

context.Database.ExecuteSqlCommand(webpages_UsersInRolesScripts.dropConstraints);

public const string dropConstraints =
    @"
    USE [DBA];
    SET ANSI_NULLS ON
    DROP CONSTRAINT [webpages_Roles_UserProfiles_Target];
    DROP CONSTRAINT [webpages_Roles_UserProfiles_Source];
    ";

这给了我一条错误消息:

Message=Incorrect syntax near the keyword 'CONSTRAINT'.
4

1 回答 1

3

我认为您需要发出这样的声明:

ALTER TABLE table_identifier DROP CONSTRAINT constraint_identifier;
于 2013-07-06T11:07:45.737 回答