|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,040,
Visits: 1
|
|
| Comments posted to this topic are about the Question of the Day for 10 Feb 2006 posted at http://www.sqlservercentral.com/testcenter/qod.asp?QuestionID=706.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Friday, July 09, 2010 6:42 AM
Points: 570,
Visits: 14
|
|
I can't execute the "second one". I have two different SELECT-Statement but it always executes the first one (in Query Analyzer). BTW: The code looks frightening  jan
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, April 08, 2010 4:54 PM
Points: 23,
Visits: 3
|
|
| Is this an error in SQL Server or can it be used for something useful?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, December 10, 2012 11:15 AM
Points: 1,394,
Visits: 197
|
|
To execute the second part of the stored procedure you need to include the 2. exec SelectTest -- will return the select from the first query exec SelectTest;2 -- will return the select from the second query
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, June 07, 2013 11:04 PM
Points: 1,894,
Visits: 206
|
|
| I'm with Mads on this one, what is the purpose of the second store procedure? Does anyone really use this feature?
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Saturday, December 16, 2006 3:56 AM
Points: 29,
Visits: 1
|
|
| Can someone point me in the direction of an explanation of the syntax involved here. I'm new to SQL Server and am trying to learn everything I can which is why I always try the question of the day. I'd like to figure out more about the ;2 part of the syntax.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 7:59 AM
Points: 2,808,
Visits: 1,129
|
|
From BOL ";number Is an optional integer used to group procedures of the same name so they can be dropped together with a single DROP PROCEDURE statement. For example, the procedures used with an application called orders may be named orderproc;1, orderproc;2, and so on. The statement DROP PROCEDURE orderproc drops the entire group. If the name contains delimited identifiers, the number should not be included as part of the identifier; use the appropriate delimiter around procedure_name only." -Kevin
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Saturday, December 16, 2006 3:56 AM
Points: 29,
Visits: 1
|
|
| Thanks for the reply. I wasn't sure what to look under in BOL so thought I'd start here.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, June 05, 2012 12:03 PM
Points: 117,
Visits: 163
|
|
If you check BOL for CREATE PROCEDURE you will find it...
You could use it for test isolation. Say you are upgrading a procedure that is used in a few locations of an application, and you want to target a specific section in testing for using the new version of the procedure... Or in some cases, more then one developer shares a test database, and you need different versions of the same procedure during development.
You could also use it (instead of using fully independently named procedures) to place different optimized version of the same procedure together.
Anyone know if there is a performance hit from having multiple versions in the same procedure?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:04 AM
Points: 1,140,
Visits: 936
|
|
| What about the query execution plan??? Does this create only one plan or more than one (based on the number of ;numbers within the procedure)
|
|
|
|