Cast in Varchar with different options

  • paresh-1036946

    Mr or Mrs. 500

    Points: 570

    Comments posted to this topic are about the item Cast in Varchar with different options

  • Ron McCullough

    SSC Guru

    Points: 63877

    Thanks for an easy, back to basics question.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • honza.mf

    SSCertifiable

    Points: 5519

    Nice one.

    But it's very hard to count the chars early in the morning. Luckily the string in b is not 31 or 32 characters long.



    See, understand, learn, try, use efficient
    © Dr.Plch

  • kupy

    SSCommitted

    Points: 1613

    honza.mf (7/16/2012)


    Nice one.

    But it's very hard to count the chars early in the morning. Luckily the string in b is not 31 or 32 characters long.

    +1

    I copied the strings to notepad to see the length :-D.

  • Samith C

    Mr or Mrs. 500

    Points: 519

    Nice question 🙂

    [font="Courier New"] Thank u Paresh for giving the basic one[/font]

    [font="Verdana"] There is no Wrong time to do a Right thing 🙂 [/font]

  • Michael Riemer

    SSCertifiable

    Points: 5096

    Nice "easy basics" question to start the week - thanks!

    Counting that many similar characters is not that easy though!!!

  • Toreador

    SSChampion

    Points: 11253

    I was expecting to see a 100% correct rate given that the same thing has appear a lot in QOTDs over the last few months - but currently just 60% so obviously bears repeating.

    The moral as always is never to rely on default precision but always specify 🙂

  • This was removed by the editor as SPAM

  • Vinay Kumar

    SSCertifiable

    Points: 6098

    Easy question but very important basic question.

    Thank. keep growing

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!

  • DugyC

    Hall of Fame

    Points: 3804

    Stewart "Arturius" Campbell (7/16/2012)


    Good back-to-basics question, thanks

    Wot he said 😛

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Duncan Pryde

    SSCertifiable

    Points: 7956

    A good question, in that if you knew the behaviour being asked about, then it was easy to pick the correct answer as there was no unnecessary obfuscation.

  • Thomas Abraham

    SSChampion

    Points: 10761

    Thanks for the question, which was perfect for a Monday. I must admit I hesitated before clicking the correct answer. A few recent questions have made me see conspiracies everywhere. 🙂

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • rhythmk

    SSCertifiable

    Points: 7162

    kupy (7/16/2012)


    honza.mf (7/16/2012)


    Nice one.

    But it's very hard to count the chars early in the morning. Luckily the string in b is not 31 or 32 characters long.

    +1

    I copied the strings to notepad to see the length :-D.

    Could have use LEN function. 😉

    SELECT LEN('aaaaaaaaaaaaaaaaaaaaabbbbbbbbb')

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • honza.mf

    SSCertifiable

    Points: 5519

    rhythmk (7/16/2012)


    kupy (7/16/2012)


    honza.mf (7/16/2012)


    Nice one.

    But it's very hard to count the chars early in the morning. Luckily the string in b is not 31 or 32 characters long.

    +1

    I copied the strings to notepad to see the length :-D.

    Could have use LEN function. 😉

    SELECT LEN('aaaaaaaaaaaaaaaaaaaaabbbbbbbbb')

    Notepad is OK, but I feel unfair to run a query or a part of it 🙂



    See, understand, learn, try, use efficient
    © Dr.Plch

  • rhythmk

    SSCertifiable

    Points: 7162

    honza.mf (7/16/2012)


    rhythmk (7/16/2012)


    kupy (7/16/2012)


    honza.mf (7/16/2012)


    Nice one.

    But it's very hard to count the chars early in the morning. Luckily the string in b is not 31 or 32 characters long.

    +1

    I copied the strings to notepad to see the length :-D.

    Could have use LEN function. 😉

    SELECT LEN('aaaaaaaaaaaaaaaaaaaaabbbbbbbbb')

    Notepad is OK, but I feel unfair to run a query or a part of it 🙂

    It is upto you if you want to learn you can use in such cases where it is hard to count the characters (exactly 30 in b option) otherwise one can directly run the query in SSMS and check the output.

    But I always use honesty is best policy to learn and test.:-)

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

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

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