Create Procedure

  • Comments posted to this topic are about the item Create Procedure

    ...

  • @ 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

  • This was removed by the editor as SPAM

  • Nice and easy but a point missed because in my pre-coffee haze I clicked the wrong answer!! :angry:


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    β€”Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • 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!

  • 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 πŸ™‚

  • 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.

  • 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.

  • 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

  • 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

  • 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]

  • I thought that the question is from the series of good practice, not about the syntax.

    Best regards,

    Mike

  • 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.

  • 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?

  • 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