• sgmunson (9/4/2015)


    mar.ko (9/2/2015)


    I need to use the same SQL source code in more than one stored proc.

    Is there a way to -include mysql.sql or something like that ?

    How does everyone handle this ? Is InsertSnippet the only way to do this ?

    ,CASE WHEN P.PROD_CTG = 'Core' AND LEFT(C.SALESFORCE_LEAD_ID,3) = '00Q' THEN S.MSL_QUANTITY ELSE 0 END AS CoreTotal

    ,CASE WHEN P.PROD_CTG = 'Core' AND LEFT(C.SALESFORCE_LEAD_ID,3) = '00Q' AND LEFT(S.OPPS_RECORD_TP_NM,5)!='Upsel' THEN S.MSL_QUANTITY ELSE 0 END AS CoreSales

    ,CASE WHEN P.PROD_CTG = 'Core' AND LEFT(C.SALESFORCE_LEAD_ID,3) = '00Q' AND LEFT(S.OPPS_RECORD_TP_NM,5)='Upsel' THEN S.MSL_QUANTITY ELSE 0 END AS CoreUpsell

    ,CASE WHEN P.PROD_CTG != 'Core' AND LEFT(C.SALESFORCE_LEAD_ID,3) = '00Q' THEN S.MSL_QUANTITY ELSE 0 END AS NonCoreTotal

    It's a nice idea, but have you considered ALL the ramifications such a feature would entail?

    1.) Where do you store the .SQL files that the feature would make use of when implemented in a production environment?

    2.) Who might need access to that location?

    3.) Who might "finger check" a file in that location, causing a massive problem if the right critical code gets whacked?

    4.) Who pays for the costs of all the human errors that can creep into such a process, along with the cost of fixing any data problems that result?

    5.) How many data problems from such a finger check might go entirely un-noticed because the nature of the problem would make it entirely impossible to determine just what data got changed?

    To be honest, given what I've seen over the years, human beings just aren't good enough to be given that level of convenience, save in a rare few instances, and in most of those scenarios, they knew better. Any decent manager these days SHOULD be tossing this idea in the dustbin of history and then incinerating it before anyone sees it.

    Heh... they already have all of this. It's called a "front end development environment". 🙂

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)