join the MSSQLTips community

Today's Site Sponsor


 

SQL Compare quickly and easily compares and synchronizes SQL Server database schemas
 



What aren't you seeing?

SQL Server 2005 Management Studio Query Designer

Written By: Jeremy Kadlec -- 10/16/2006 -- read/post comments -- print -- Bookmark and Share

Rating: (not rated yet) Rate

Problem
When writing queries I either need to reference an existing data model or visualize the tables in my head in order to complete my query.  Does a visual query tool exist in the SQL Server 2005 tool set?  If so, how can I access it and use it to streamline my development process?

Solution
The SQL Server 2005 Management Studio ships with Query Designer which in a nutshell is a visual querying tool to build SELECT statements.  (*** NOTE *** - This tool was available in SQL Server 2000 from Enterprise Manager.) This is an add-in to the Query Window offering a means to add specific tables from a specific database to the designer.  You can see a visual representation of the tables with the referential integrity all in one screen, then build the needed query with JOINs, WHERE and\or ORDER BY clauses.

How do I access the SQL Server 2005 Management Studio Query Designer?

  1. Open SQL Server 2005 Management Studio
  2. Click the 'New Query' button from the standard tool bar or press Ctrl+Shift+Q
  3. On the SQL Editor tool bar, select the needed database from the database drop down list in our case 'BaltSSUG'
  4. On the SQL Editor tool bar, click on the 'Design Query in Editor' button
  5. Follow the steps in next section to select the needed tables, then build and test the query

What are the capabilities with the SQL Server 2005 Management Studio Query Designer?

  1. Select the user defined tables needed for the query.  *** NOTE *** - System tables are not available as options in this tool.

  1. Once the tables load in the top of the interface, arrange the tables so they make sense.  Next select the columns that you want to use in the query as well as the alias, sort type, sort order, etc.  Notice how the T-SQL for the SELECT statement is being created and updated as columns are chosen.  Finally, press the 'OK' button and the query will then load into the original query window as show in step 3.

  1. The query as setup in step 2 will load into the original Query Editor window where the query can be executed, tested and modified to meet your needs.

Can this tool help me with INSERT, UPDATE or DELETE statements?

Yes - as a matter of fact.  Just right click in the query pane and select Change Type and then the type of query desired.

Next Steps

Readers Who Read This Tip Also Read Free Live Webcast Comment or Ask Questions About This Tip


Sponsor Information
Free SQL Server performance monitoring dashboard – Idera SQL check

Increase your SQL speed and accuracy with code completion from SQL Prompt.

SQL Server Issues? Not sure where to turn for answers? Innovative SQL DBA consultants

Attend a SQL Server Conference for Free

Valuable SQL Server web casts on Performance Tuning, Development, Administration, Disaster Recovery, Replication and more...


Get Our Tips Newsletter

We keep 50,000+ SQL Server professionals informed.



Red Gate Software - SQL Data Generator

Test your database until it cries… “Red Gate’s SQL Data Generator has overnight become the principal tool we use for loading test data to run our performance and load tests.” Grant Fritchey, FM Global.

Download now!

More SQL Server Tools
SQL secure

SQL Data Generator

SQL comparison toolset

SQL Compare

SQL compliance manager




Copyright (c) 2006-2010 Edgewood Solutions, LLC All rights reserved
privacy statement | disclaimer | copyright | advertise | write for mssqltips | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


CareerQandA.com | MSSharePointTips.com | MSSQLTips.com