Ukryj spis treści

Creating a Transaction-SQL Query

Use the Transaction-SQL (T-SQL) editor in the SQL Management Studio to create and test queries to be used for reports.

To create a T-SQL query:

  1. Log on to Microsoft SQL Server Management Studio:
    1. From the Windows Start menu, click All Programs > Microsoft SQL Server 2008 > SQL Server Management Studio.
    2. In the Connect to Server dialog box, click Connect.
  2. In the left pane, expand Databases and expand the database for which you want to create an SQL query.

    Expand Tables to see the database tables.

  3. Right-click the database and click New Query.
  4. In the right pane, create a T-SQL query using these elements:

    Syntax Example
    SELECT column
    SELECT U.Username, G.Groupname, G.Description
    FROM table_name
    FROM Users U, Groups G, GroupMembers M
    WHERE selection_criteria
    WHERE G.GroupID = 2 AND
          G.GroupID = M.GroupID AND 
          U.UserID = M.UserID
    You cannot use variable names defined in a report query argument when you create a T-SQL query.

    After you add the T-SQL query to a report query, you can add argument substitution.

    The following is an example of a completed T-SQL query:

    SELECT U.Username, G.Groupname, G.Description
    FROM Users U, Groups G, GroupMembers M
    WHERE G.GroupID = 2 AND
          G.GroupID = M.GroupID AND 
          U.UserID = M.UserID

  5. Click Execute (toolbar) or Query > Execute.

    The Results tab shows the data returned by the query.

    If there are problems, the Messages tab describes the query errors.

  6. Repeat steps 4 and 5 until your SQL query returns the information you want.
  7. To test the query on another vault, select the vault database from the Available Databases field above the left pane.
  8. Copy the SQL query.
  9. Open a formatted report query in Notepad.

    For information on formatting a report query, see Formatting a Report Query.

  10. Paste the SQL query into the §Sql section of the report.
  11. Save the completed report query as a .crp file.


Wyraź swoje opinie dotyczące tego tematu

SOLIDWORKS docenia wszelkie informacje i uwagi dostarczone przez użytkownika na temat prezentacji, dokładności oraz prawidłowości dokumentacji. Proszę użyć poniższego formularza, aby wysłać komentarze I sugestie na temat tego tematu do naszego zespołu dokumentacyjnego. Zespół dokumentacyjny nie może udzielać informacji na pytania natury technicznej. Proszę kliknąć tutaj, aby uzyskać informacje dotyczące pomocy technicznej.

* Wymagane

 
*Email:  
Temat:   Opinie dotyczące tematów pomocy
Strona:   Creating a Transaction-SQL Query
*Komentarz:  
*   Oświadczam, że zapoznałem/zapoznałam się z polityką prywatności, zgodnie z którą moje dane osobowe będą wykorzystywane przez firmę Dassault Systèmes, i niniejszym ją akceptuję

Wydrukuj temat

Wybierz zakres treści do druku:

x

Wykryliśmy że używasz przeglądarki w wersji starszej niż Internet Explorer 7. Dla zoptymalizowanego wyświetlania sugerujemy uaktualnienie przeglądarki do Internet Explorer 7 lub nowszej.

 Nie pokazuj tego komunikatu ponownie
x

Wersja zawartości pomocy w sieci Web: SOLIDWORKS PDM 2011 SP05

Aby wyłączyć pomoc w sieci Web w oprogramowaniu SOLIDWORKS i użyć zamiast tego pomocy lokalnej, należy kliknąć Pomoc > Użyj pomocy SOLIDWORKS w sieci Web.

Aby zgłosić problemy związane z interfejsem lub funkcją wyszukiwania pomocy w sieci Web, należy skontaktować się z lokalnym przedstawicielem pomocy technicznej. Aby wyrazić opinie dotyczące poszczególnych tematów pomocy, należy użyć łącza “Opinie dotyczące tego tematu” na stronie danego tematu.