While loop 2

  • Comments posted to this topic are about the item While loop 2

  • Thanks for a good question - good thing I had my coffee before answering

    Again thanks

    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]

  • Thanks Sreenivas for the question. Indeed we discussed the situation of "Divide by zero error" in your earlier QOTD discussion forum "While Loop - 1".

    All in all ending this week on a good note 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Good Morning Sreeni.. Thanx for the easy Point..

  • Thanks for good question. Error is because of data type. SQLserver implicitly convert float into integer for @b-2 variable. Hence divide by zero error encountered.

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • I am newbie..

    can anyone explain me why divide by zero error encountered...

    as 10/.001 is thr

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Oopes I am clear with answer now..

    I confused with the byte size of int and float so select wrong answer... 🙁 🙁

    as .001 will will gets converted into 0 so when counter moves to 4 it will show error 'divide by zero encountered'

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Easy points in a row, fine. 🙂

  • Good question, thank you. Had to read twice to make sure I wasn't missing a 'trick'!

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • Nice question, thanks!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Lokesh Vij (10/11/2012)


    Thanks Sreenivas for the question. Indeed we discussed the situation of "Divide by zero error" in your earlier QOTD discussion forum "While Loop - 1".

    All in all ending this week on a good note 🙂

    And I didn't have to rethink for this one..;-):w00t::hehe:

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • Damn it. Answered the question fast. Did not see the variable @b-2 is int.

  • Easy one to end the week. Thanks Sree 🙂


    Sujeet Singh

  • Darn! Saw the question, and for a few various reasons I thought it was the same question as the last time, and presumed a mistake with SSC or caching or something, so answered same as last time and Doh! Wrong!

    That'll teach me not to pay attention :doze:

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

  • Thanks for the easy question to end the week on a high note!

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

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