Results 1 to 6 of 6

Thread: Stored Procedure

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Stored Procedure

    I have one stored procedure in MS SQL Server.

    sp_DeleteEmployee @id INT

    I can call this stored procedure by two way.
    One is:
    VB Code:
    1. cnn.Execute "sp_DeleteEmployee " & txtID.Text
    The other used Command Objcet and Parameter, then execute the Command Object.


    Which one is better? why?

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Stored Procedure

    This was just discussed yesterday in this thread...

    http://www.vbforums.com/showthread.php?t=369262

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Stored Procedure

    And please don't name your stored procedures with an sp_ prefix.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Re: Stored Procedure

    Why shouldn't I name your stored procedures with an sp_ prefix?

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Stored Procedure

    SQL Server assumes a stored procedure with a sp_ prefix is a system stored procedure. The Master database is checked first and if the procedure exists there it will be executed. If not then the procedure in the current database is executed.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Stored Procedure

    Quote Originally Posted by ychhuong
    Why shouldn't I name your stored procedures with an sp_ prefix?
    You can name my SPs whatever you want, I was just giving you some advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width