• Tobar (3/26/2013)


    I see that part, but the error I was getting, which I should have mentioned in the beginning, was

    "Error converting data type nvarchar to numeric". And I don't think your example would explain how an intermediate conversion to float would make it all work.

    SELECT convert(decimal(3,1),convert(float, '333.14'))

    I appreciate your interest in helping me understand this.

    OK sorry:

    you really get this error in SSMS:

    SELECT convert(decimal(3,1),convert(float, '333.14'))

    Msg 8115, Level 16, State 6, Line 1

    Arithmetic overflow error converting float to data type numeric.

    the specific reason is the definition of Decimal(3,1);

    that says 3 significant digits TOTAL, and one of those digits is to the right of the decimal point.

    333.14 is five significant digits, and two to teh right of the decimal point; so it will not fit in the defined size.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!