Introduction to Stored Procedures

  • Sean Burke

    SSCommitted

    Points: 1504

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/sburke/introductiontostoredprocedures.asp

  • nsearle

    SSC Journeyman

    Points: 90

    Great article, but I'm having problems with who the owner should be in the CREATE PROCEDURE line.

    When I try to enter my own username as the owner, it shows an error message, and won't let me save the procedure. I have also tried 'dbo_user' with the same result.

    I've read elsewhere that the owner of the stored procedure should be the same as the owner of the objects it uses in order to avoid 'broken ownership chains'- whatever that is!

    Who should the user be?

  • Andy Warren

    SSC Guru

    Points: 119676

    Best practice is to have all objects owned by dbo. You can either create them and later change the owner, or you have to be the dbo (db owner) of the database. You can accomplish that either by connecting with any login that has sysadmin rights, or by setting up an alias for your login to dbo.

    Andy

  • nsearle

    SSC Journeyman

    Points: 90

    Okay- that works. Thanks a lot.

  • philcart

    SSC-Forever

    Points: 47779

    Good introductory article. Will you be doing a follow-up article? I'd like to see one on using the T-SQL templates which aid in quickly creating standardised SP's.

    Thanks

    Phill Carter

    --------------------
    Colt 45 - the original point and click interface

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply