A Token Escape

  • Comments posted to this topic are about the item A Token Escape

  • Good question thanks.

    ...

  • In the code provided with the question, ESCAPE_QUOTE is used, which is not a valid macro. It should be ESCAPE_SQUOTE or ESCAPE_DQUOTE.

    Sql Server blog: http://www.tsql.nu

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • That was surprisingly easy for one of Andy's questions. There weren't any tricks or things that we should have inferred from the position of a comma :cool:. I only had to read one page of documentation to find the answer and I found that page by Googling something that was provided in the question.

    Andy, you're slipping πŸ˜€

    Joking aside, I wasn't aware you could do that and I think it will actually come in pretty useful soon.


    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

  • Great question, really made you stop, drop and read the documentation.

    Even if in the end I copped out and choose "not enough info" πŸ˜€

  • I didn't know, so chose "I don't know", but was told that apparently I did know after all.

    Obviously I'm cleverer than I thought.

  • Toreador (4/28/2016)


    I didn't know, so chose "I don't know", but was told that apparently I did know after all.

    Obviously I'm cleverer than I thought.

    Plus you knew in advance that's what would happen, so you must be clever AND psychic! πŸ˜›

  • BWFC (4/28/2016)


    That was surprisingly easy for one of Andy's questions. There weren't any tricks or things that we should have inferred from the position of a comma :cool:. I only had to read one page of documentation to find the answer and I found that page by Googling something that was provided in the question.

    Andy, you're slipping πŸ˜€

    I think I agree. I last used this feature in SQL Server 2000, but was aware of the changes introduced in 2005 (escape macros) and have kept track since. I thought I had the answer when I read the code (no S or D before the Q) but the third answer option made it clear that that was just a typo. But options 1 (if that had said 2012 instead of 6.5 it might have been a better distractor) and 3 were obviously wrong, option 2 was surely a joke (an agent job producing an error message when agent wasn't running), and option 5 was almost as comical as option 3. Option 4 was possible, but maybe we didn't have enough information to claim that the feature wasn't enabled, because the question didn't state whether it was or not - but that would make both options 6 and 7 correct and two correct options are just not on so option 3 it had to be.

    Maybe options 6 and 7 are both there in order to soften us up for a future question where only one of them is offered, and is teh correct answer?

    Tom

  • Magnus, I'll send a note to have the question updated about ESCAPE_SQUOTE. Can't believe I missed that.

  • Glad you all enjoyed the question. I like to mix it up now and then on the complexity scale, and yes, some of the answers were fairly comical:-)

    I think there are times when the tokens are useful, but I ended not liking them for the scenario I had at work. It pains me to not be able to fully something without putting it into a job - too easy to make the ESCAPE_QUOTE instead of ESCAPE_SQUOTE typo. I guess it's all the same in the end, testing interactively or testing by running the job, is just SEEMS easier to concatenate!

    I'm working on my next question, I think it will be "A Proc State Exam". Sometimes the title has clues, sometimes just whimsy!

  • TomThomson (4/28/2016)


    BWFC (4/28/2016)


    That was surprisingly easy for one of Andy's questions. There weren't any tricks or things that we should have inferred from the position of a comma :cool:. I only had to read one page of documentation to find the answer and I found that page by Googling something that was provided in the question.

    Andy, you're slipping πŸ˜€

    I think I agree. I last used this feature in SQL Server 2000, but was aware of the changes introduced in 2005 (escape macros) and have kept track since. I thought I had the answer when I read the code (no S or D before the Q) but the third answer option made it clear that that was just a typo. But options 1 (if that had said 2012 instead of 6.5 it might have been a better distractor) and 3 were obviously wrong, option 2 was surely a joke (an agent job producing an error message when agent wasn't running), and option 5 was almost as comical as option 3. Option 4 was possible, but maybe we didn't have enough information to claim that the feature wasn't enabled, because the question didn't state whether it was or not - but that would make both options 6 and 7 correct and two correct options are just not on so option 3 it had to be.

    Maybe options 6 and 7 are both there in order to soften us up for a future question where only one of them is offered, and is teh correct answer?

    I still don't know as I don't understand what all the talk of tokens and escape macros is all about. So I want my point for saying I don't know.

  • I was just thinking this would make a pretty good TV type game show. QOTD Olympics? QOTD Survivor? Hard enough without time pressure:-)

  • Andy Warren (4/28/2016)


    Magnus, I'll send a note to have the question updated about ESCAPE_SQUOTE. Can't believe I missed that.

    Even though knowing the answer what it could be... that missing "S" in the question leaded me to select the wrong choice and made me think that "you missed S there and seems like a catch and you mention S in the answer and it seemed like a typo, okay lets go with it"... and man.... the gun wasn't empty.

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

Viewing 15 posts - 1 through 15 (of 24 total)

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