August 5, 2018 at 8:39 pm
We have a situation where the Lead SQL Developer is leaving the company and he says there's no documentation on the database structure, or what reports use which tables, queries, stored procs, functions etc. What is the best way to document table relationships in SQL so we are not in this position again in the future?
I'm starting with Visio entity diagram, also using Excel. However, any software you use to best documents reports and the tables, procs, etc. used for certain processes, would be helpful.
Thank you for your advice.
Charles P
August 6, 2018 at 3:18 am
Hi Charles,
I can think of the following options:
1. Database diagrams - could be useful to find out primary-key foreign key relationships between the tables,
2. You can also use the sql_dependencies view as:
SELECT DISTINCT OBJECT_NAME(object_id) AS ReferencingObject, OBJECT_NAME(referenced_major_id) AS ReferredObject FROM sys.sql_dependencies
The second option will give you the list of stored procedures / functions that are using certain tables etc.
Thanks.
August 6, 2018 at 6:36 pm
Charles_P - Sunday, August 5, 2018 8:39 PMWe have a situation where the Lead SQL Developer is leaving the company and he says there's no documentation on the database structure, or what reports use which tables, queries, stored procs, functions etc. What is the best way to document table relationships in SQL so we are not in this position again in the future?I'm starting with Visio entity diagram, also using Excel. However, any software you use to best documents reports and the tables, procs, etc. used for certain processes, would be helpful.
Thank you for your advice.
Charles P
Have you taken the time to look at any of the stored procedures, functions, and views for embedded documentation? If there's any, that's where you find what you won't find anywhere else except maybe in any documentation that might be in the extended properties of the objects. Ah... one more place. Documentation in the SQL Agent Jobs, themselves or maybe even in the ticketing system that keeps track of requests and where the source code for the changes are stored. Also, did you folks use the idea of requirements documents followed with function design documents?
Do any of the other developers have the essential tribal knowledge to carry on?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 6, 2018 at 9:21 pm
Thank you both. Good advice. I tried the database diagram and it is very useful. I'm also starting to look at any documentation inside of the stored procedure, functions and views.
Thanks,
Charles P
August 6, 2018 at 10:23 pm
Charles,
Try the following link on an artical about retreiving the database METADATA: https://dzone.com/articles/retrieving-table-metadata-from-sql-server-catalog
The artical explains with SQL Scripts to pull the information you are looking for that is "user" freindly. Another way is to use the Script database task, this will create all the nessicary code to rebuild a clean version of the database with:
* Tables
* Views
* Primary Keys
* Foreign Keys
* Indexes
* Triggers (Including Code)
* Check Clauses (Including Code)
* Stored Procedures·
Tim Morehead
August 7, 2018 at 5:54 am
Tim,
I don't know about anyone else but that came out looking like a very strange language. Not sure what font you uses but there's a one to one character match.
Here's what Tim posted in a more readable fashion...
_________________________________________________________________________
Charles,
Try the following link on an artical about retreiving the database METADATA: https://dzone.com/articles/retrieving-table-metadata-from-sql-server-catalog
The artical explains with SQL Scripts to pull the information you are looking for that is "user" freindly. Another way is to use the Script database task, this will create all the nessicary code to rebuild a clean version of the database with:
* Tables
* Views
* Primary Keys
* Foreign Keys
* Indexes
* Triggers (Including Code)
* Check Clauses (Including Code)
* Stored Procedures·
--Jeff Moden
Change is inevitable... Change for the better is not.
August 7, 2018 at 5:56 am
Charles_P - Monday, August 6, 2018 9:21 PMThank you both. Good advice. I tried the database diagram and it is very useful. I'm also starting to look at any documentation inside of the stored procedure, functions and views.Thanks,
Charles P
I'm hoping that someone actually enforced some standards for commenting for you and that they turn out decent. It's a tough row to hoe when you lose key people.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 7, 2018 at 6:11 am
Timmorehead 14652 - Monday, August 6, 2018 10:23 PMCharles,
Try the following link on an artical about retreiving the database METADATA: https://dzone.com/articles/retrieving-table-metadata-from-sql-server-catalog
The artical explains with SQL Scripts to pull the information you are looking for that is "user" freindly. Another way is to use the Script database task, this will create all the nessicary code to rebuild a clean version of the database with:
* Tables
* Views
* Primary Keys
* Foreign Keys
* Indexes
* Triggers (Including Code)
* Check Clauses (Including Code)
* Stored Procedures·
Tim Morehead
I'll just say "It's all Greek to me..."...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
August 7, 2018 at 6:12 am
Look at SQL Tool belt by Red Gate, the sponsors of this site. some great documentation tooling, source code control and migration scripting functions. Apex and Pragmatic Works (now part of Sentry One) also do database documentation tools. I think Apex can also document SSRS reports and SSIS packages.
No affiliation, just a satisfied customer.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply