sqlcmd outputs too many deciaml places

  • I have a sql statement that outputs numbers to 2 decimal places. When I execute the same sql statement using sqlcmd it outputs some figures to 16 decimal places. Even if I change the sql statement to round the figures to 2 decimal places it still outputs 16! :w00t:

    Why is sqlcmd doing this?

  • Kelvin Phayre (6/16/2009)

    Why is sqlcmd doing this?

    Hi,

    Post your statement and the table schema to better assistance in this issue

    ARUN SAS

  • CREATE TABLE [dbo].[FHInvoiceDetail](

    [delivery_note_number] [char](10) NOT NULL,

    [line_number] [char](4) NOT NULL,

    [suppliers_product] [char](20) NOT NULL,

    [product_description] [char](40) NULL,

    [pack_size] [char](10) NULL,

    [quantity_invoiced] [float] NULL,

    [unit_value_ex_vat] [float] NULL,

    [line_value_ex_vat] [float] NULL,

    [vat_code] [varchar](1) NULL,

    [vat_rate] [float] NULL)

    If I change

    [unit_value_ex_vat] [float] NULL,

    [line_value_ex_vat] [float] NULL,

    to

    [unit_value_ex_vat] [numeric](18, 2) NULL,

    [line_value_ex_vat] [numeric](18, 2) NULL,

    then sqlcmd works fine.

    This does not explain why I get different results between sqlcmd and management studio output.

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

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