Create a stored procedure

  • .

  • Msg 156, Level 15, State 1, Procedure my_sp, Line 2

    Incorrect syntax near the keyword 'FROM'.

    the explanation says

    "Actually SQL Srever only check syntactical accuracy when a stored procedure is created. Only syntactical errors are reported on a procedure definition "

    which is what my error message says

    so "None of the above" is the correct answer

  • Went for none of the above as I thought SQL would fall over on 'column'...

  • Toreador (10/15/2014)


    paul.knibbs (10/15/2014)


    I mean, the error about incorrect syntax near "FROM" isn't one of the available answer options, so it should be pretty obvious that's not what was intended.

    It would be covered by the "none of the above" option

    Yes, none of the above should be the correct answer.

    /Håkan Winther
    MCITP:Database Developer 2008
    MCTS: SQL Server 2008, Implementation and Maintenance
    MCSE: Data Platform

  • The below mensioned query is right for your answer.

    CREATE PROCEDURE my_sp AS

    SELECT [COLUMN] FROM my_table

    Thanks,
    Shiva N
    Database Consultant

  • Apparently it was not "none of the above".

    I wonder if some of the QotD authors actually run their queries.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • +1, Koen. i-e One should always test the script.

    but author intentions was right about the question so for this i would say nice question Jaime 🙂

  • Msg 156, Level 15, State 1, Procedure my_sp, Line 2

    Incorrect syntax near the keyword 'FROM'.

    Oops.

  • paul.knibbs (10/15/2014)


    Maybe the author chose the column name deliberately to catch out people who just run the SQL rather than thinking about their answer? I mean, the error about incorrect syntax near "FROM" isn't one of the available answer options, so it should be pretty obvious that's not what was intended.

    Or maybe people know column is a reserved keyword (as in ALTER TABLE ... ALTER COLUMN) and they expect another error. And choose thus "none of the above"...

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I also chose 'none of the above' , which in my opinion is the correct answer for this QOTD, even if it's not the intention of the author.

  • Koen Verbeeck (10/15/2014)


    paul.knibbs (10/15/2014)


    Maybe the author chose the column name deliberately to catch out people who just run the SQL rather than thinking about their answer? I mean, the error about incorrect syntax near "FROM" isn't one of the available answer options, so it should be pretty obvious that's not what was intended.

    Or maybe people know column is a reserved keyword (as in ALTER TABLE ... ALTER COLUMN) and they expect another error. And choose thus "none of the above"...

    If you follow the task to the letter, the script throws an "incorrect syntax near the word FROM" error and so therefore the correct answer is "none of the above". The provided answer is wrong. End of.

  • This was removed by the editor as SPAM

  • Stewart "Arturius" Campbell (10/15/2014)


    Enough nitpicking.

    yes, the question used a reserved keyword for a column name (purely by mishap, i'm sure).

    but, despite that little inconvenience, the idea behind the question was good.

    Hope to see more questions from you, Jaime

    To my way of thinking that's two major snafus there. First, using a reserved word for a column name, and second assuming the script would behave as described WITHOUT TESTING. The idea behind the question might have been good, but the execution sucked.

  • BWFC (10/15/2014)


    Mauricio N (10/15/2014)


    Same error: Msg 156, Level 15, State 1, Procedure my_sp, Line 2

    Incorrect syntax near the keyword 'FROM'.

    +1

    +1 here too. This time the answer is actually wrong and not a misinterpretation. Not much room for ambiguity here.

  • paul.knibbs (10/15/2014)


    Maybe the author chose the column name deliberately to catch out people who just run the SQL rather than thinking about their answer? I mean, the error about incorrect syntax near "FROM" isn't one of the available answer options, so it should be pretty obvious that's not what was intended.

    Running the SQL does not mean that I don't think about the answer. I do think about the answer and like the author should have, I test to confirm.

Viewing 15 posts - 16 through 30 (of 64 total)

You must be logged in to reply to this topic. Login to reply