Wednesday, March 7, 2012

Execute SQL greyed out in Query Designer?

If I right click in a query pane and select Query Designer in SQL management Studio, or select an existing query and do the same I get the query designer and can monkey about with the SQL add tables etc...

But I can't Execute the SQL or see the results. These options are greyed out. This is a pain as I keep having to select the SQL and paste it back into the query window, easy enough but when it takes a coulpe of minutes to untangle the tables as they are laid out in the visual editor this is just a very painful way of debugging the bad joins and stuff my web team keep putting in.

Is there any way of getting a visual query designer I can actively work in?

many thanks

Steve

I've had exactly the same problem and after a bit of research came across this:

http://www.developermania.com/newsgroups/item/130965/Query_Designer.aspx

Its basically a reply to a posting last year from Keith Wilson at microsoft that seems to indicate that this is functionality they didn't implement in the original release and that was beyond the service pack. I get the impression therefore that the menu selections are simply acting as placeholders for functionality that has not been built yet?!!

There's a few posts out there concerning this issue but I've not come across a solution. Let me know if you have better luck!

Regards

Rick Edwards

|||

The functionality is there to execute the query, but not available in the mode the designer is running in when you design a query in the T-SQL script editor. The general idea was that you would run the query in the editor itself, not in the dialog hosting the designer.

The "open table"/"open view" functionality is really the query designer as well, but its running in a more capable mode. When you right click on a table or view in object explorer and select the "Open..." menu item, the query designer will start with "select * from {my table}" as the SQL text, but with only the results pane being shown. You can use this as a trick to get to a more functional version of the query designer. Create an empty table (so there are no results to fetch), then open it. Once you have the table open, you can show the SQL, Diagram, or Query By Example panes by clicking the appropriate button in the toolbar, delete the existing text and do what you need to do.

I know this is a pretty baroque way to get to the query designer. If you find yourself using this functionality often, you might consider going to the http://connect.microsoft.com/sqlserver site and suggesting that we provide a more direct way to get to the more fully-functional version of the query designer. We use customer feedback like this when we are considering which features to implement in future versions.

Hope this helps,
Steve

|||

OK its a bit of an obscure way of getting there but I find that pretty acceptable. The greyed out option confused the hell out of me though.

Many thanks for taking the time to answer this one. The trick of getting at the full query designer is going to save me a huge amount of time.

No comments:

Post a Comment