August 21, 2018 at 11:51 am
Just was wondering if someone has a favorite format for a descriptive and useful header for stored procedures so that other people could clearly see what modifications you have made, where, and why.
Likes to play Chess
August 22, 2018 at 10:23 am
The where and what I'd get some version control. If you're not using this, you're hoping developers don't make mistakes, which is not likely as we're all human.
I tend to use
/*
Procedure Description: This is what this process accomplishes. As I get new requirements, I'd alter this.
Changes:
20180722 jsj This is a change I made because Jira 001
20180801 brb The proc had a bug with NULL, so added a COASLESCE
20180820 brb Found a bug referenced in JIRA 002. Added padding to the result
*/
What I hope is that developers think about their change and add a quick date/description of why they changed something. Diff tools should find what/where.
August 22, 2018 at 10:48 am
I like to have the audit trail comments in the script in source control that aren't included in the stored procedure when it's put on the database.
At the top of the body I like to see a sample call of the stored procedure, this can be viewed by looking at the stored procedure on the database. So my scripts look something like this:/*
--***************************************************************************************************
-- * Script : PROCEDURE dbo.INFAddOrganisationOrganisationType
-- *
-- * Purpose : Maintain data on OrganisationOrganisationType
-- *
-- * History :
-- * Ver Date Author Description
-- * --- ---------- ------------ ---------------------------------
-- * 1 24/03/2016 S Smith New stored procedure
-- * 2 20/04/2016 S Smith Add Financial Period
--****************************************************************************************************
*/
IF OBJECT_ID('dbo.INFAddOrganisationOrganisationType','P') IS NULL BEGIN
EXEC('CREATE PROCEDURE dbo.INFAddOrganisationOrganisationType AS')
END
GO
-- *************************************************************************
-- Sample Call:
-- EXEC INFAddOrganisationOrganisationType 'abc', 'MANUFACT'
-- *************************************************************************
ALTER PROCEDURE dbo.INFAddOrganisationOrganisationType
(
@OrganisationCode nvarchar(10),
@OrganisationType nvarchar(10)
) AS
BEGIN
...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply