Home All Groups Group Topic Archive Search About

Management Studio & Views containing unions

Author
25 Aug 2006 9:11 AM
Stephan Steiner
Hi

I'm having a major beef with Management Studio Express when it comes to
editing Views that contain a UNION statement. For starters, it can't display
the View, which I guess is OK, the old tool couldn't do that either. But,
the syntax verification doesn't work either.. I get an "Incorrect Syntax
near UNION" error each time. But, if the syntax is valid, saving is no
problem.. and neither is a select on the view.

Why does MSE choke on a union even if the query is valid? I can understand
the issues regarding displaying a query that contains unions, but if valid
syntax is used, why can a query not be syntax checked?

Regards
Stephan

Author
26 Aug 2006 10:18 AM
Erland Sommarskog
Stephan Steiner (stephan.stei***@nextiraone.ch) writes:
> I'm having a major beef with Management Studio Express when it comes to
> editing Views that contain a UNION statement. For starters, it can't
> display the View, which I guess is OK, the old tool couldn't do that
> either. But, the syntax verification doesn't work either.. I get an
> "Incorrect Syntax near UNION" error each time. But, if the syntax is
> valid, saving is no problem.. and neither is a select on the view.
>
> Why does MSE choke on a union even if the query is valid? I can understand
> the issues regarding displaying a query that contains unions, but if valid
> syntax is used, why can a query not be syntax checked?

Rather than selecting Modify from the context menu, continue down to
Script View As to get the view in a plain query window instead of the
crappy Query Designer.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button