You are currently offline, waiting for your internet to reconnect

Error message when you try to import a Transact-SQL script in Visual Studio 2005 Team Edition for Database Professionals: "The .sql file contains more than one data definition language (DDL) statement."

SYMPTOMS
When you try to import a Transact-SQL script to a database project in Microsoft Visual Studio 2005 Team Edition for Database Professionals, you may receive an error message that resembles the following:
The .sql file contains more than one data definition language (DDL) statement. Remove any additional statements, and retry the operation.
This problem occurs if the following conditions are true:
  • The script contains multiple constraint statements.
  • The script contains a Data Definition Language (DDL) statement such as the following:
    ALTER TABLE [dbo].[titleauthor] ADDCONSTRAINT [FK__titleauth__au_id] FOREIGN KEY ([au_id]) REFERENCES [dbo].[authors] ([au_id]),CONSTRAINT [FK__titleauth__title] FOREIGN KEY ([title_id]) REFERENCES [dbo].[titles] ([title_id])
    Note The DDL statement is valid. The statement runs successfully in SQL Server Management Studio.
CAUSE
This problem occurs because Visual Studio 2005 Team Edition for Database Professionals does not parse the DDL statement correctly.
WORKAROUND
To work around this problem, manually split the script into multiple statements in the script file. For example, split the script as follows:
ALTER TABLE [dbo].[titleauthor] ADDCONSTRAINT [FK__titleauth__au_id] FOREIGN KEY ([au_id]) REFERENCES [dbo].[authors] ([au_id])ALTER TABLE [dbo].[titleauthor] ADDCONSTRAINT [FK__titleauth__au_id] FOREIGN KEY ([au_id]) REFERENCES [dbo].[authors] ([au_id])
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
TSQL T-SQL
Properties

Article ID: 928963 - Last Review: 12/13/2006 22:13:10 - Revision: 1.0

  • Microsoft Visual Studio 2005 Team Edition for Database Professionals
  • kbtshoot kbprb KB928963
Feedback