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 ««1234»»»

Create stored procedure Expand / Collapse
Author
Message
Posted Wednesday, March 16, 2011 7:09 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:01 AM
Points: 1,232, Visits: 1,046
paul s-306273 (3/16/2011)

{ [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }


The point of the question is about the minimum amount of code needed to create a Stored Procedure. Apparently 15% of the people responding do not know the answer. After checking online there is a question on the MS SQL certification exams that is almost word for word like this one.



I liked the question! Of course I like most of the questions I get right!
Post #1078922
Posted Wednesday, March 16, 2011 7:13 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, August 17, 2011 7:09 AM
Points: 869, Visits: 963
Scott Arendt (3/16/2011)
ronmoses (3/16/2011)
paul s-306273 (3/16/2011)
I don't really see the value of this question...

The nearly 40% of respondents who got it wrong learned something today. That alone seems valuable enough to me, especially since that's the entire point of QotD.


Just because something is learned, does not necessarily mean that it has value. It only has value if it is useful. I would say that this is more interesting than useful.


Value is in the eyes of the beholder!
Post #1078926
Posted Wednesday, March 16, 2011 7:48 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, August 26, 2014 4:51 AM
Points: 1,854, Visits: 3,451
paul s-306273 (3/16/2011)
I don't really see the value of this question...

Also, from BOL:

{ [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }
One or more Transact-SQL statements comprising the body of the procedure. You can use the optional BEGIN and END keywords to enclose the statements. For information, see the Best Practices, General Remarks, and Limitations and Restrictions sections that follow.

That states ONE OR MORE, not none or more.

Another "funny" thing is that BEGIN...END does not define the body of the procedure. You can have multiple BEGIN...END in the body of a procedure, like this:
create proc test
as
begin
select 1
end
begin
select 2
end

Executing "test" will return two recordsets.

A procedure can have an empty body, but BEGIN...END cannot be empty.
Post #1078969
Posted Wednesday, March 16, 2011 7:48 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 11:48 PM
Points: 418, Visits: 576
Its not really adding any value..
Post #1078970
Posted Wednesday, March 16, 2011 7:59 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 11:26 AM
Points: 668, Visits: 485
Interesting question...
Post #1078986
Posted Wednesday, March 16, 2011 8:26 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 7:27 PM
Points: 33,204, Visits: 15,351
Scott Arendt (3/16/2011)
ronmoses (3/16/2011)
paul s-306273 (3/16/2011)
I don't really see the value of this question...

The nearly 40% of respondents who got it wrong learned something today. That alone seems valuable enough to me, especially since that's the entire point of QotD.


Just because something is learned, does not necessarily mean that it has value. It only has value if it is useful. I would say that this is more interesting than useful.


It's valuable if you learn what not to do or what might cause a problem. It's not always what is positively learned. sometimes it's what is negative that you should avoid.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1078998
Posted Wednesday, March 16, 2011 9:27 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 8:57 AM
Points: 208, Visits: 460
Interesting.
Post #1079052
Posted Wednesday, March 16, 2011 10:20 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: 2 days ago @ 1:51 PM
Points: 21,644, Visits: 15,317
Thanks for the question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1079093
Posted Wednesday, March 16, 2011 11:40 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Saturday, August 23, 2014 8:01 PM
Points: 1,364, Visits: 1,056
There's always value in understanding the exceptions.

The young man knows the rules, but the old man knows the exceptions. ~Oliver Wendell Holmes Sr.
Post #1079162
Posted Wednesday, March 16, 2011 12:39 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 8:18 AM
Points: 3,909, Visits: 3,636
Just don't forget to put the GO at the end, otherwise when you put it into an upgrade script you never know what you are going to get.
Post #1079220
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse