November 3, 2015 at 10:13 pm
Comments posted to this topic are about the item Create Procedure
...
November 3, 2015 at 10:16 pm
@ the time of posting this, I was the only 1 who got it right out of 9 attempts π
EZ question, sp_*** for system SP`s.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
November 3, 2015 at 10:57 pm
This was removed by the editor as SPAM
November 4, 2015 at 1:00 am
Nice and easy but a point missed because in my pre-coffee haze I clicked the wrong answer!! :angry:
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
November 4, 2015 at 1:17 am
I think the reason "Options 1, 2 and 3" has more votes than "Option 2" is because of course you should also avoid statements that cause a syntax error. The question could have been clearer!
November 4, 2015 at 1:29 am
paul 25096 (11/4/2015)
I think the reason "Options 1, 2 and 3" has more votes than "Option 2" is because of course you should also avoid statements that cause a syntax error. The question could have been clearer!
agree π
November 4, 2015 at 1:40 am
Iulian -207023 (11/4/2015)
paul 25096 (11/4/2015)
I think the reason "Options 1, 2 and 3" has more votes than "Option 2" is because of course you should also avoid statements that cause a syntax error. The question could have been clearer!agree π
Yes!
Are these red herrings?
Suggest this guy doesn't post more questions of this type.
November 4, 2015 at 1:58 am
Iulian -207023 (11/4/2015)
paul 25096 (11/4/2015)
I think the reason "Options 1, 2 and 3" has more votes than "Option 2" is because of course you should also avoid statements that cause a syntax error. The question could have been clearer!agree π
I also agree with these comments above. If they give syntax errors then you have no choice but to avoid them.
November 4, 2015 at 2:02 am
tripleAxe (11/4/2015)
I also agree with these comments above. If they give syntax errors then you have no choice but to avoid them.
You do have a choice - you could just correct the syntax errors.
CREATE PROCEDURE [sp-MyProc] AS
select Name from department
CREATE PROCEDURE [1MyProc] AS
select Name from department
will both work
November 4, 2015 at 2:16 am
Toreador (11/4/2015)
tripleAxe (11/4/2015)
I also agree with these comments above. If they give syntax errors then you have no choice but to avoid them.
You do have a choice - you could just correct the syntax errors.
CREATE PROCEDURE [sp-MyProc] AS
select Name from department
CREATE PROCEDURE [1MyProc] AS
select Name from department
will both work
Agreed as well. Asking if you would avoid calling an sp 1MyProc, the simple answer is yes, because you can't do it. Why try doing something you can't?
I'll admit, I didn't select sp_MyProc though (for an answer of options 1, 2 & 3), so I still got it wrong!
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 4, 2015 at 2:24 am
Not really a sensible answer I felt, Nice that we shouldnt use sp_ since it reserved for system keyword, but you have to accept that option 1 and 3 are not also not allowed.
The answer shouldn't have that option either. Dislike for the question (n)
[font="Verdana"] There is no Wrong time to do a Right thing π [/font]
November 4, 2015 at 2:30 am
I thought that the question is from the series of good practice, not about the syntax.
Best regards,
Mike
November 4, 2015 at 2:38 am
I gave the correct answer, but was doubting. The "should" triggered something in my mind to read it as "you can but it is not a good option".
However, you can also say "When creating stored procedures, you should not use incorrect SQL, since then the stored procedure won't be created.".
I can understand that people got confused over this, and that in my mind two answers can be seen as correct.
November 4, 2015 at 2:43 am
These questions are starting to get ridiculous - options 1,2 and 3 shouldn't be used because they don't work, or may cause a minor performance hit or clash with existing system names...
But that answer for 1,2,3 is wrong because the fact that they will cause a syntax error (due to the rules for database identifiers) means that they cannot be used... so rather than being a question about SQL Server it is actually a question about how to interpret the phrase "should you avoid" and whether "because it will not work" is a valid reason for avoiding something.
Maybe the problem I have is that I have a different interpretation of the words of the English language to some others?
November 4, 2015 at 3:06 am
Larnu (11/4/2015)
Asking if you would avoid calling an sp 1MyProc, the simple answer is yes, because you can't do it.
But you can do it - I gave you the syntax.
Whether you would want to is another matter of course, and partly comes down to house rules (applying which my correct answer would be 'none of the above' as we call all stored procedures 'usp_xxx')
Viewing 15 posts - 1 through 15 (of 74 total)
You must be logged in to reply to this topic. Login to reply