我遇到SQL查询的语法问题,无法为DNN模块创建表。我已经仔细检查了我的代码,似乎无法找到问题。但是,DNN安装一直说'FK_bank_statement_day_name_table'附近的语法不正确。我已经彻底地对它进行了交叉检查,但似乎无法想象
ALTER TABLE {databaseOwner}[{objectQualifier}bank_statement_day]
WITH CHECK ADD CONSTRAINT [FK_bank_statement_day_name_table] FOREIGN
KEY([file_name])
REFERENCES {databaseOwner}[{objectQualifier}name_table] ([file_name])
ALTER TABLE {databaseOwner}[{objectQualifier}bank_statement_day]
CHECK CONSTRAINT [FK_bank_statement_day_name_table]
答案 0 :(得分:1)
您可能遇到DNN问题,因为您错过了GO语句。请尝试以下方法:
ALTER TABLE {databaseOwner}[{objectQualifier}bank_statement_day]
WITH CHECK ADD CONSTRAINT [FK_bank_statement_day_name_table] FOREIGN
KEY([file_name])
REFERENCES {databaseOwner}[{objectQualifier}name_table] ([file_name])
GO
ALTER TABLE {databaseOwner}[{objectQualifier}bank_statement_day]
CHECK CONSTRAINT [FK_bank_statement_day_name_table]
GO