Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck Stored Proc into source control: What to check in?
    primarykey
    data
    text
    <p>I have some SPs that I want to be under source control, but the question is what do I add?</p> <p>Ideally I want some way to purely get the source of the SP, however all I can get is alter, create, etc scripts which I do not consider to be the raw source. The closest I can get is running sp_helptext 'mysp'.</p> <p>Is there some way to purely get the source of an SP?</p> <p>I am running SQL Server 2008 R2.</p> <p>EDIT: I understand the usefullness of being able to grab what is in source control and update/deploy a SP, however I am firmly against this. This code is useful situationally, irrelevant when making diffs to see changes and generic (violates DRY principle. eg. SQL Server 2010 has a new way to create and drop sps.. need to update the 'source' for all my SPs?). If I wanted something like this I would be much more inclined to make a script that will deploy a SP to a server (eg. deploy dp_mysp prod).</p> <p>Is there a way to get just the guts of an SP? Or is it actually stored as a create procedure script?</p> <p>EDIT2: </p> <p>Cheers guys.</p> <p>I don't object to versioning settings and references (or deployment scripts which is the best analogy IMO) as they exist in <em>one</em> place and are reusable nuggets of goodness. The key sucky thing about this is the same deployment code exists in <em>many</em> places and must be maintained in many places. There is no dependency between this code and each sp, so it adds cruft to every sp. Why don't we add generic deployment code to every file in our solution so they are self deployable?</p> <p>Anyway, I guess we will have to agree to disagree on this one. I am definitely being a purist and I don't think there is much practical benefit to what I want, but for me being super anal about development is what makes it fun :)</p> <p>No-one helped me get closer to what I want than sp_helptext 'mysp' (and I am guessing it is impossible at this point) or convinced me I should be checking in something else, so I am going to leave the question unanswered.</p> <p>Thanks again.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload