SQL Stored Procedure Code Summarization

Our client has 100 SQL-stored procedures from one of their legacy applications, they don’t have any documentation for these procedures. So, we wanted to use OpenAI to code summarization and documentation for each of these procedures. Has anyone tried this use case using OpenAI? Did you face any issues (except the token limits) while sending SQL code to the API? Any reference code is available?
Thanks in advance.

1 Like

Do they have the DB schema? If so that is known to be of value as part of the prompt with creating SQL and I would also suspect in understanding SQL procedures.

Also, why use the API, the free ChatGPT I would suspect is more than capable of doing it with a decent prompt. You may have to modify the prompt some and perhaps give names to fields if they are a bit cryptic.

1 Like

Yeah, why use the API for a one-off if slightly repetitive task?

1 Like

Thanks for your reply, Eric. They do have DB Schema which gives us some info.
Though we are considering ChatGPT too, considering they have thousands (Not 100) of procedures, someone needs to manually sit and do one-by-one for each procedure. Instead, it, we are thinking of doing this programmatically and procedure documentation which may be 50-60% accurate, and then do manual validation and updates.

Thank you for the update. It would have been helpful if this information had been provided earlier, as it would have saved us some time.

You also need to consider that there is no requirement that one stored procedure is asked as one question. The limit is the number of combined tokens used. So structure the prompts to do multiple stored procedures at a time.

Thanks Eric for your response. Its helpful