Professional Web Applications Themes

Anybody use proc # with CREATE PROC? - Microsoft SQL / MS SQL Server

Does anyone use the [ ; number ] option when creating a procedure (CREATE PROC [ EDURE ] procedure_name [ ; number ] )? The only way this seems to be usefull is for being able to drop several procedures with just one command. I tried this script: CREATE PROCEDURE Test;1 AS PRINT '1' GO CREATE PROCEDURE Test;2 AS PRINT '2' GO EXEC Test DROP PROCEDURE Test and only "1" showed up in the output. It would've been more useful if both stored procs had executed with just one "EXEC". If this is all it is good for, I wouldn't ...

  1. #1

    Default Anybody use proc # with CREATE PROC?

    Does anyone use the [ ; number ] option when creating a procedure (CREATE PROC [ EDURE ] procedure_name [ ; number ] )?

    The only way this seems to be usefull is for being able to drop several procedures with just one command. I tried this script:

    CREATE PROCEDURE Test;1 AS

    PRINT '1'
    GO

    CREATE PROCEDURE Test;2 AS

    PRINT '2'
    GO

    EXEC Test

    DROP PROCEDURE Test

    and only "1" showed up in the output. It would've been more useful if both stored procs had executed with just one "EXEC".

    If this is all it is good for, I wouldn't think too many people would be use this option.

    Mark

    Mark Guest

  2. #2

    Default Re: Anybody use proc # with CREATE PROC?

    Yes. The whole reason behind it is to consolidate them all for
    management/cleanup purposes. If you call "sp" without the explicit ";#" then
    only the first one get called.

    However, the "drop proc Test" would drop both procedures for you.

    --
    -oj
    RAC v2.2 & QALite!
    http://www.rac4sql.net



    "Mark B" <net> wrote in message
    news:bellsouth.net... 
    PROC [ EDURE ] procedure_name [ ; number ] )? 
    procedures with just one command. I tried this script: 
    stored procs had executed with just one "EXEC". 
    use this option. 


    oj Guest

  3. #3

    Default Re: Anybody use proc # with CREATE PROC?

    Hi

    You can use EXEC Test;1 etc which means that different versions of the same
    procedure could be run depending on some criteria.

    Some of the procedures in master have versions.

    John




    "Mark B" <net> wrote in message
    news:bellsouth.net... 
    PROC [ EDURE ] procedure_name [ ; number ] )? 
    procedures with just one command. I tried this script: 
    stored procs had executed with just one "EXEC". 
    use this option. 


    John Guest

Similar Threads

  1. Proc::Fork
    By Michael in forum PERL Beginners
    Replies: 3
    Last Post: July 13th, 09:11 PM
  2. ASP vs Stored Proc vs UDF
    By Brad in forum ASP Database
    Replies: 11
    Last Post: October 28th, 01:46 AM
  3. SQL / Stored proc help
    By vf in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 30th, 07:07 PM
  4. new proc
    By alex in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 18th, 04:27 PM
  5. stored proc and tcp/ip
    By Helmut Wöss in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: June 30th, 08:13 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139