Truncate rollback

  • The insert statement has a syntax that is unacceptable to SQL Server 2005. So why wasn't it stated as being compatible with SQL Server 2008 and later only?

    We should get our points back.

    Kenneth Spencer

    You never know: reading my book: "All about your computer" might just tell you something you never knew!
    lulu.com/kaspencer

  • [font="Verdana"]

    kaspencer (4/22/2010)


    The insert statement has a syntax that is unnacptable to SQL Server 2005. So why wasn't it stated as being compatible with SQL Server 2008 and later only?

    We should get our points back.

    Kenneth Spencer

    Digesting loss of points, is if not Very Tough but at least, it is Tough, I think.

    It’s frequent in case QODs, so be brave, as me lost last day’s points.;-)

    [/font]

  • I got this right, but only because the question was on ROLLBACK and I gambled on the INSERT statement being an mistake/typo. I didn't know that it would run OK as is on SQL Server 2008, so I did learn something. It should have been stated which version this applied to.

  • My answer is ERROR

    as insert query given me error. moreover yes Rollback can rollback pages truncated by TRUNCATE.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near ','.

    Thanks

  • So I learnt about a new feature of the INSERT statement in SQL 2008.

    Definitely use feature that when systems finally upgraded to SQL 2008.

    Perhaps I should have paid closer attention at the title of the QOD to give me a hint, rather than the obvious syntax error based on current SQL version I generally use.

    ------

    Robert

  • I also learned something today. For the 1st time, I made the mistake of pressing enter after a single letter 's' in Sql Server 2005.

    The 's' was automagically turned into 'SELECT'. Same for 'i' and 'd'. Does everybody know this, or I am the only one left in the wagon? 😀

  • Open Minded (4/22/2010)


    I also learned something today. For the 1st time, I made the mistake of pressing enter after a single letter 's' in Sql Server 2005.

    The 's' was automagically turned into 'SELECT'. Same for 'i' and 'd'. Does everybody know this, or I am the only one left in the wagon? 😀

    Are you sure this was SQL Server 2005? It sounds suspiciously like the IntelliSense feature that was introduced in SQL Server 2008. Or do you have a third party IntelliSense tool installed?


    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/

  • good to learn of this new syntax change, should have specified SQL 2008 though.

    ---------------------------------------------------------------------

  • Hugo Kornelis (4/22/2010)


    Open Minded (4/22/2010)


    I also learned something today. For the 1st time, I made the mistake of pressing enter after a single letter 's' in Sql Server 2005.

    The 's' was automagically turned into 'SELECT'. Same for 'i' and 'd'. Does everybody know this, or I am the only one left in the wagon? 😀

    Are you sure this was SQL Server 2005? It sounds suspiciously like the IntelliSense feature that was introduced in SQL Server 2008. Or do you have a third party IntelliSense tool installed?

    My apologies. It seems I had installed 'SSMS Tools Pack' a week ago or so? Then I forgot about it...On closer look at the page, it was for 'an Add-In for Microsoft SQL Server Management Studio (Express)'.

  • insert into a (b) values (1), (2), (3)

    The above statement will result in the error mentioned below in case u use any other version of SQL other than SQL 2008

    Incorrect syntax near ','.

    So the questions should be generic enough to be compatible with all the available versions of SQL.

  • Useful, if only to learn about the new INSERT syntax

  • Hugo Kornelis (4/22/2010)


    Good question. Not sure why it's worth 2 points; knowing that TRUNCATE can be rolled back should be elementary knowledge.

    Abrar Ahmad_ (4/22/2010)


    [font="Verdana"]Goodish, easy hunt. but for the only SQL Server 2008 users.:-D[/font]

    Why is it only for SQL 2008 users? You are not supposed to answer by running the code, but to guess based on your knowledge. If you follow announcements and read articles, you know about the new INSERT syntax in SQL2008. (But it would have been better if the words "SQL Server 2008" had been included somewhere in the question).

    I toyed with the idea of including 2008 in there, but I felt it gave better challenge if the code couldn't be run.

    Anyhow I see how hard it is to get a "perfect" question in there. Takes a lot of thinking.

  • Tom Brown (4/22/2010)


    Useful, if only to learn about the new INSERT syntax

    Cool, I'm glad many of you had a chance to learn 2 things in this question. I headr you to not make this version specific without telling you about it so I won't be this to death and answer all other posts about this.

  • Christian Buettner-167247 (4/22/2010)


    The following setting will cause the error:

    SET IMPLICIT_TRANSACTIONS ON

    If this is turned on, the create table statement will also be rolled back, causing the error.

    Thanks I hadn't considered that one.

  • Thanks for your question as well. As you already indicated, it is hardly possible to cover all cases any time. Keep up the good work!

    Best Regards,

    Chris Büttner

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

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