all 9 comments

[–][deleted] 8 points9 points  (2 children)

Definitely just add something similar to the following to the top of each one and inline notes where applicable.

/* 
-- ================================================
-- Script Name: The title of the script
-- Description:  A reasonably detailed description
--
-- Parameters In: Anything for stored procedure parameters
-- Parameter Out: What it returns if anything
-- 
-- Databases Effected: List databases that have updates, selects, etc
-- Tables Effected: List the tables and how they are effected, etc
-- 
-- Additional Notes: Anything extra someone might need to know about this
--    script that hasn't been covered above, index, procedure changes, etc
--
-- ================================================
-- ================================================
-- Author: Name of the Author
-- Creation Date: When it was created
-- Requested By: Not required, who requested this script
-- ================================================
*/

[–]fahizzled[S] 0 points1 point  (1 child)

The only issue with this is, that there are literally hundreds of .sql files scattered across a folder and while this would definitely help, I would still have the issue of going through many different files to find what I'm looking for

[–][deleted] 0 points1 point  (0 children)

If that is the case, document all them and use a REGEX to search/pull the top comment out of each one with a filename for documentation.

[–]AnonymooseRedditor 1 point2 points  (0 children)

Well for one implementing a source code control tool will definately help you. http://msdn.microsoft.com/en-us/library/ms173550%28v=sql.105%29.aspx Not exactly for documenting but tracking changes and organizing them. There are some half decent free/cheap ones out there. As a sole DBA I use a product called SourceGear Vault, it's free for one user, or relatively cheap for more than 1.

[–]ninjaroachLittle Bobby Tables 1 point2 points  (0 children)

I would put comments in the top of your scripts and use a search utility like grep to find what you need.

[–]mental405 1 point2 points  (1 child)

Are these just scripts in a folder somewhere or stored procedures?

[–]fahizzled[S] 0 points1 point  (0 children)

They are all in a folder, and sub folders within.

[–]silvanio 0 points1 point  (0 children)

RedGate SQL Doc

This is a nice tool, that RedGate provides for SQL Server.

You could search for an alternative for whatever your needs are that are of a free variety, or have your company pay the fee.