You are currently offline, waiting for your internet to reconnect

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"

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: 07/16/2009 07:49:36 - Revision: 1.0

Microsoft Visual Studio Team System 2008 Database Edition

  • kbexpertiseadvanced kbqfe kbsurveynew kbprb KB970583
Feedback
= 1; var varClickTracking = 1; var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write("