• cengland0 (2/15/2012)


    The BOL reference also says:

    The MERGE statement requires a semicolon (;) as a statement terminator. Error 10713 is raised when a MERGE statement is run without the terminator.

    I didn't see that semicolon in the statement in the QOTD.

    I got it right, for all the wrong reasons.

    The script will not run, regardless of triggers, for two reasons:

    1. The MERGE statements must be terminated with a semicolon. This one isn't, so the script would fail.

    2. Adding column names to a table alias is not valid syntax. SQL Server will interpret this as a table hint - and neither Form_ID nor Form_Name is recognised as a valid hint.

    Without those two errors, I would probably have given the wrong answer. Thanks for teaching me something I didn't know!


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/