Create a stored procedure

  • The correct answer is NONE OF THE ABOVE. If you don't bracket the reserved word column you are going to get:

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

    Incorrect syntax near the keyword 'FROM'.

    Which CLEARLY falls under the answer NONE OF THE ABOVE.

  • I thought it was a trick question because the "none of the above" answer was provided, and "column" (without quotes) is a syntax error, not a valid column name. So I selected the "none of the above" answer and got the question wrong.

    Boo!

  • Given answer is wrong, Sql server will give error on given procedure.

    because "Column" is a reserved keyword and needs to be delimited if you want to use it as a column (e.g. [Column]).

  • Me three... or four... or however many people have already responded...

  • +1

  • I will get an error like this: Server: Msg 208, Level 16, State 1, Procedure my_sp, Line 2 Invalid object name 'my_table'.

  • Even with COLUMN instead of COLUMNS, this was a good question - just look at the spread of percentages on each of the five answers.

    Hoping to see more from Jamie - with final testing included. 😀

    "Would everyone who has never made a mistake please raise their hands."


    Here there be dragons...,

    Steph Brown

  • I also got error

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

    Incorrect syntax near the keyword 'FROM'.

  • dhans123 (10/15/2014)


    I also got error

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

    Incorrect syntax near the keyword 'FROM'.

    Thanks for the question:-)

    Got the same on 2014, non of the options are correct, maybe different settings?

    On my system, this works

    CREATE PROCEDURE my_sp AS

    SELECT [column] FROM my_table

    😎

  • +1 to all the comments that pointed out the answer is incorrect. Good question to examine the defered name resolution idea - but need to verify code? Made it ambiguous what was intended.

  • Can anyone tell when column name given as "ID", why is not giving error?

  • gyan_119 (10/15/2014)


    Can anyone tell when column name given as "ID", why is not giving error?

    Because ID is not a reserved word as column. If you want to use SELECT column FROM MyTable you need to do it like this: SELECT [column] FROM MyTable.

  • As many people have said - the correct answer to the question asked was 'None of the above'.

    Nit picking would apply if the correct answer was below 'None of the above' in the list and you were to argue that 'None of the above' still applied

  • Question is corrected and points awarded back

  • comments added to the topic

Viewing 15 posts - 46 through 60 (of 64 total)

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