What will be the output message?

  • Figured out that the missing quote had nothing to do with the question but missed the part where text data type is used.

    Are people still using those horrible data types? Is it difficult to migrate text/ntext columns to varchar(max)/nvarchar(max) columns?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • When I read through the question, I saw what looks like eight extra apostrophes, not just the one in the pronunciation helper for "Grisham". However, the extra apostrophes in Dean Koontz's biography are actually what Microsoft calls "smart quotes" - the ones that are slanted, not vertical, and T-SQL doesn't care about those (nor does it care about the slanted quotation marks that are in there as well). It does care about the one in the pronunciation guide, however, which is ironic, since another one in "Grisham''s first bestseller" was correctly doubled.

    I thought that the extra apostrophes were going to generate the error message, and didn't notice the use of LEN with a TEXT column, so I got the right answer for the wrong reason. :hehe:

    Thanks for the good question, Kshitij, but you should have actually tried it first in SSMS with the biography text before submitting it.

  • Yeah, I've been bitten by text columns when I was unfamiliar with the schema.

    Don Simpson



    I'm not sure about Heisenberg.

  • Luis Cazares (12/3/2014)


    Figured out that the missing quote had nothing to do with the question but missed the part where text data type is used.

    Are people still using those horrible data types? Is it difficult to migrate text/ntext columns to varchar(max)/nvarchar(max) columns?

    Yes people are. Better yet is that MS products still use it.:sick:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Emil Bialobrzeski (12/3/2014)


    Koen Verbeeck (12/3/2014)


    Nice question.

    The original INSERT statement misses one quote though.

    But I figured out this was a typo and it had no influence on the answer. 😎

    Regardless to it being a typo or not the answer is still the same 🙂 only the error message is different

    Good point.

  • This is because LEN function does not work for text, ntext and image data types.

    new things added in my mind memory...:-D

    Manik
    You cannot get to the top by sitting on your bottom.

Viewing 6 posts - 16 through 20 (of 20 total)

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