SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question of the Day for 10 Feb 2006


Question of the Day for 10 Feb 2006

Author
Message
Fal
Fal
Right there with Babe
Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)

Group: General Forum Members
Points: 770 Visits: 1809

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?


~Sreejith G
~Sreejith G
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1959 Visits: 213

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%


D-Man-459314
D-Man-459314
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1065 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.
Fal
Fal
Right there with Babe
Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)Right there with Babe (770 reputation)

Group: General Forum Members
Points: 770 Visits: 1809
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.
D-Man-459314
D-Man-459314
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1065 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 :-)
kapil_kk
kapil_kk
SSCertifiable
SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)

Group: General Forum Members
Points: 5206 Visits: 2767
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/
Ken Wymore
Ken Wymore
SSCertifiable
SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)

Group: General Forum Members
Points: 6515 Visits: 2396
I've been working with SQL Server for over 15 years and I have never seen this syntax used before. Interesting behavior and something I hope to never deal with in production.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search