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."

Article translations Article translations
Article ID: 928963 - View products that this article applies to.
Expand all | Collapse all

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] ADD
    CONSTRAINT [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] ADD
CONSTRAINT [FK__titleauth__au_id] FOREIGN KEY ([au_id]) REFERENCES [dbo].[authors] ([au_id])
ALTER TABLE [dbo].[titleauthor] ADD
CONSTRAINT [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.

Properties

Article ID: 928963 - Last Review: December 13, 2006 - Revision: 1.0
APPLIES TO
  • Microsoft Visual Studio 2005 Team Edition for Database Professionals
Keywords: 
kbtshoot kbprb KB928963

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com