6

How can I best extract the documentation strings from T/SQL scripts and present them as a user-frienfly API documentation? I know about tools like Doxygen, Javadocs or Sphinx, but none of them seem to know about SQL.

For example, I want to be able to make use of the documentation in scripts that contain create statements like follows:

/**
 * This is a stored procedure.
 *
 * @param foo foo does bar
 */
create procedure my_proc(foo varchar(100)
...
GO
quazgar
  • 4,304
  • 2
  • 29
  • 41
Behrang
  • 46,888
  • 25
  • 118
  • 160
  • I edited the question to make it more answerable as per e.g. [this Meta post](https://meta.stackoverflow.com/questions/288832/which-questions-about-programming-tools-are-allowed) and I think it can be reopened now. – quazgar Dec 02 '20 at 16:18

2 Answers2

4

You should try Natural Docs to document SQL-procedures. It is open-source, really straight forward and well documented. An example would look like

/**
 * This is a stored procedure.
 *
 * Parameters:
 *   foo - foo does bar
 */
create procedure my_proc(foo varchar(100)
...
GO

The output is generated as nice-looking HTML. You can specify custom sections for return-values, date and author, or include usage-guidelines and code samples in your output. Have fun!

der Michi
  • 139
  • 1
  • 7
1

The SQL Refactor tool together with the SQL Prompt tool from Red gate Might have what you are looking for. link I have used it a long time ago to document my own Stored Procs

Josef Van Zyl
  • 915
  • 3
  • 19
  • 43