decimal issue

  • declare @x1 varchar(10)

    declare @x2 decimal(38,7)

    set @x2 =22225655.95163

    set @x1=convert(nvarchar,@x2)

    set @x2=convert(decimal(38,7),@x2)

    print @x1

    its output is 22225655.9

    wht shud i pit in scale if i want to display 7 digits after decimal point?....

  • MonsterRocks (11/14/2010)


    declare @x1 varchar(10)

    declare @x2 decimal(38,7)

    set @x2 =22225655.95163

    set @x1=convert(nvarchar,@x2)

    set @x2=convert(decimal(38,7),@x2)

    print @x1

    its output is 22225655.9

    wht shud i pit in scale if i want to display 7 digits after decimal point?....

    @x2 is already correctly formatted. @x1 is not displaying the full compliment due to the string length restriction. Try the following,

    declare @x1 varchar(30)

    declare @x2 decimal(38,7)

    set @x2 =22225655.95163

    set @x1=convert(nvarchar,@x2)

    set @x2=convert(decimal(38,7),@x2)

    print @x1

    print @x2

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 2 posts - 1 through 1 (of 1 total)

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