FIX: Error message when you have a stored procedure that contains some JOIN operations and a UNION operation in a Microsoft SQL Server Database project in Visual Studio Team System 2008 Database Edition GDR: "TSD02010: Incorrect syntax near UNION"

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

SYMPTOMS

You add a stored procedure to a Microsoft SQL Server Database project that is created by using Microsoft Visual Studio Team System 2008 Database Edition GDR. When you save the .proc.sql file that corresponds to the stored procedure or when you build the project, you receive the following error message in the Error List window:

TSD02010: Incorrect syntax near UNION.
This problem occurs when the following conditions are true:
  • The stored procedure contains some JOIN operations and a UNION operation.
  • The query expressions before and after the UNION operation have a different number of parenthesis that resemble the following:
    (query_expression1)
    
    union 
     
    query_expression2

RESOLUTION

To resolve this problem, upgrade to Microsoft Visual Studio Team System 2008 Database Edition GDR R2. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
970479 List of fixed issues in the Microsoft Visual Studio Team System 2008 Database Edition GDR R2

Note Microsoft Visual Studio Team System 2008 Database Edition GDR R2 replaces Microsoft Visual Studio Team System 2008 Database Edition GDR.

WORKAROUND

To work around this problem, make sure that the number of parentheses around the query expression before the UNION operation is the same as the number of parentheses around the query expression after the UNION operation. For example, you can work around this problem by using one of the following examples:
(query_expression1) 
union
(query_expression2)
or
query_expression1 

union 

query_expression2 

Properties

Article ID: 970583 - Last Review: July 16, 2009 - Revision: 1.0
APPLIES TO
  • Microsoft Visual Studio Team System 2008 Database Edition
Keywords: 
kbexpertiseadvanced kbqfe kbsurveynew kbprb KB970583

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