December 15, 2009 at 6:15 am
When I run the query outside of sqlcmd I get 1234.56. When trapping output from sqlcmd I get 1,234.56
Please help as the output is a CSV file and as such is corrupted by the formatting of the thousands separator.
Please note that the number is outputted in the following format.
cast (tax_amount-vat_amount as numeric(18,2))
I did it like this to stop sqlcmd padding numbers with leading zeroes. Yet another annoying habit!
December 15, 2009 at 6:24 am
Are you using the "-R" argument of SqlCmd?
--Jeff Moden
Change is inevitable... Change for the better is not.
December 16, 2009 at 2:27 am
Yes that fixed it. Many thanks.
Where can I read up on the effects of taking the -R off.
How do I change the regional settings in my SQL Server i.e. remove the , in thousands?
Thanks again
December 16, 2009 at 5:56 am
Kelvin Phayre (12/16/2009)
Yes that fixed it. Many thanks.Where can I read up on the effects of taking the -R off.
How do I change the regional settings in my SQL Server i.e. remove the , in thousands?
Thanks again
You can read all about the various switches for SQLCMD in Books Online (the help system that comes with SQL Server). You need to look in Windows Help to figure out how to change the system Regional Settings.
However, I'd be tempted to just leave the -R turned off and write the query to do the fixed formatting.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply