Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Question of the Day for 10 Feb 2006 Expand / Collapse
Author
Message
Posted Sunday, February 12, 2006 3:38 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, July 3, 2014 9:19 PM
Points: 505, Visits: 1,691

My initial thoughts on reading this was "1 Procedure, the second generates an error".  Finding no option for this, I went for "None, a error will be raised."

Reading the explantion, I put this through Server Management Studio to see this procedure that has two lots of code, only to get: None - error raised.  Specifically "Msg 102, Level 15, State 1, Procedure SelectTest, Line 1  Incorrect syntax near ';'"

I refreshed, did it again, etc, but I still have no procs at all - let along 1 proc with both codes!

So I shut down Management Studio, restarted, checked, executed code, and got "Command(s) completed successfully."  But still no procs!  Indeed, I can keep on running it with no DROP statements and it will always be successful.  (But with no procs.

So, what am I missing?

 

Post #257778
Posted Monday, February 13, 2006 2:03 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, July 28, 2014 1:20 PM
Points: 1,732, Visits: 40

If you guys tried to attend all QOD question then you would have came accross one DLL Hell question. This is another way of asking the same question

See the old question below =>

Thanks, Sree

Question: Everyone has heard of DLL hell, but DBAs know only too well about object-version hell. Which object has a limited versioning capability in MSSQL 2000?
Contributed by R. Kevin Gunther


Correct Answer: Stored Procedures

You Answered: DTS Packages

Total Participants: 1768

Total Correct Answers: 356 or 20.1% of participants
Your Total Score and Standings



Explanation:
Stored procedures allow you to "version" them by appending a ";#" to the end of the name. All stored procedures are named "objectname;1", with the ";1" implicit (and thus invisible). Interestingly, MSSQL places all versions of the SP in the same code, and under the default object name. So, if you created versions 1-3 of a stored procedure, and then looked in the list of stored procedures in Query Analyzer, you'd only see the original object name, not 3 objects incremented by the ";number" counter. Opening up the stored procedure, you'd see three different CREATE statements, one for each version, all in the same stored procedure. This allows all versions of the stored procedure to be dropped with one DROP statement. Practically, this means that you can have multiple versions of a stored procedure running concurrently in one application, regardless of any differences. However, each version must be called explicitly by its name and number; otherwise, only the default is called.


How other members answered

Answer

# Who Chose It

Percentage

2 (B). DTS Packages

1078

61.0%

4 (D). Stored Procedures

356

20.1%

5 (E). Indexes

175

9.9%

1 (A). Tables

90

5.1%

3 (C). Views

69

3.9%

 

Post #257809
Posted Friday, October 12, 2007 7:18 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, November 1, 2009 12:14 PM
Points: 1,059, Visits: 52
The supplied answer is simply wrong!

To separate procedures are created.

As Books Online states (about the number "n" that can be supplied when creating a stored procedure):
"Is an optional integer that is used to group procedures of the same name"

The plural word "procedures" clearly indicates that there is more than one.
Post #409957
Posted Sunday, October 14, 2007 8:31 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, July 3, 2014 9:19 PM
Points: 505, Visits: 1,691
D-Man (10/12/2007)
The supplied answer is simply wrong!
The plural word "procedures" clearly indicates that there is more than one.


For what it's worth, I just retested this and got 1 proc with multiple CREATE statements. Nor do the numbers need to be sequential. This was on a SQL Server 2005 box, Dev. Ed.

Did you get individual procs? I ask coz I seem to be only able to drop the entire set not individual versions, which limits the useability of this feature I feel.

S.
Post #410680
Posted Monday, October 15, 2007 2:12 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, November 1, 2009 12:14 PM
Points: 1,059, Visits: 52
If you refer to the fact that scripting the procedure(s!) generates one script with two create statements then that is not really the point (that is just a matter of SSMS implementation)

The point is that it is two different objects that are created, altered and called individually (dropped as a group, though)

This is, as quoted, backed up by the official documentation, which, aside from the quoted part, refers to the concept as "group of procedures"

I rest my case
Post #410720
Posted Thursday, November 22, 2012 2:45 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 3:27 AM
Points: 1,893, Visits: 2,329
ohh its a nice and intresting thing to know...
learn something new today



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1387785
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse