隱藏目錄

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 and 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.
  10. Paste the SQL query into the 刨ql section of the report.
  11. Save the completed report query as a .crp file.


提供對此主題的意見反應

SOLIDWORKS 歡迎您提供有關於文件呈現方式、正確性、及完整性的意見反應。請使用下方的表格直接將您對此主題的意見與建議傳送給我們的文件團隊。文件團隊並無法回答關於技術支援的問題。按一下此處來獲得關於技術支援的資訊

* 必要的

 
*電子郵件:  
主旨:   說明主題的意見反應
頁面:   Creating a Transaction-SQL Query
*意見:  
*   我承認已閱讀且僅此接受隱私權政策,Dassault Systèmes 將遵循此政策之規定使用我的個人資料

列印主題

選擇要列印的內容範圍:

x

偵測到您使用的瀏覽器版本是舊於 Internet Explorer 7。要獲得最佳的顯示,建議您升級瀏覽器到 Internet Explorer 7 或更新的版本。

 不要再次顯示此訊息
x

Web 式說明內容版本:SOLIDWORKS PDM 2014 SP05

要從 SOLIDWORKS 中停用 Web 式的說明並改用本機說明,請按一下說明 > 使用 SOLIDWORKS Web 式說明

要報告在 Web 式說明介面及搜尋中遇到的問題,請聯絡您當地的技術支援代表。要針對個別說明主題提供意見反應,請使用個別主題頁面中的「提供對此主題的意見反應」連結。