Share via


How to Create a SQL Statement by Using Query Designer

 

Updated: January 1, 2014

Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager

Query Designer in SQL Server can help you to more easily write SQL queries that can be used in your Configuration Manager reports. Use the following procedures to create Configuration Manager report queries using Query Designer.

To create a new SQL query in Query Designer

  1. Start Microsoft SQL Server Management Studio.

  2. Navigate to <Computer Name> \ Databases \ <Configuration Manager database name> \ Views.

  3. Right-click Views and then click New View.

  4. In the Add Table dialog box, click the Views tab and then select the views that you want to include in the SQL query.

    Note

    You can select multiple views by holding down the CTRL key.

  5. In the design view of query designer, select the columns you want to appear in the report. If you are querying multiple views, you can join these by selecting a column in one view and dragging this over to the same column in another view.

  6. Click the Execute SQL button to test the query and see the results.

  7. When you are happy with the results returned by the query, copy and paste it from query designer to be used to create your report in Report Builder.