This is part of a series of documents aimed towards providing the basics of creating queries for SOLIDWORKS PDM vault databases. Administrators will be able to collect data for their own purposes that are not attainable from SOLIDWORKS PDM out-of-the-box search features.
This document also provides a way to graphically see the relationships between vault database tables to then plan an approach for building a query. Use these steps to generate a diagram of table relationships for your specific vault database using Microsoft SQL Server Management Studio (SSMS).
For the basic level of queries that you will be able to create with this series, you would need to understand why table relationships are important. There are many relationships between tables in a vault database. Here are two to illustrate how tables relate. If you need to query the ID of the folder in which the file is stored, you would need to “Join” two SQL tables. The “Documents” table which has the file name, and the “DocumentsInProjects” table which has the ID of the folder.
Joining the DocumentID column for both the output query is the following.
We have now successfully joined the two tables and see the corresponding ProjectID for the files you are interested in. Using a “WHERE” clause, you can further “filter” the results. This type of joining is called INNER JOIN. It is shown by the connecting line between the two tables in a diagram.
Click Yes if prompted to create the necessary support objects.
The most common tables to query are:
It may take SSMS a few moments to complete the diagram – depending on how many tables you have chosen. After all the desired tables have been selected, click Close. Inspect the diagram and adjust by dragging the tables or relation lines as you see necessary. Below is an example of a diagram showing connections between the Documents, DocumentsInProjects, and Projects tables.
I hope you found this article helpful. For additional content like this, check out the related articles below.
About Francisco Guzman
Francisco Guzman is the PDM Technical Support Lead at GoEngineer, and is pursuing his degree in mechanical engineering at the University of Utah. In addition to providing guidance and support to SOLIDWORKS and SOLIDWORKS PDM customers, Francisco also provides support for DriveWorks design automation. He won the world-wide DriveWorks reseller CPD contest as the best DriveWorks AE for 2015. For fun, he designs, 3D-Prints, builds and races custom first-person-view (FPV) racing drone frames.
Get the latest articles delivered daily to your inbox, unsubscribe at any time.