Hoang Hong Khang
Hoang Hong Khang

Reputation: 43

How to change the decimal separator from a comma to a dot in SQL Server

SQL Server displays decimal separator as a comma instead of a dot, so the generated script couldn't be executed.

image1

Upvotes: 4

Views: 23578

Answers (1)

Pieter Geerkens
Pieter Geerkens

Reputation: 11883

This SQL demonstrates how to use the culture parameter of the Format function:

declare @f float = 123456.789;

select
  [raw]      = str(@f,20,3)
 ,[standard] = cast(format(@f, 'N', 'en-US') as varchar(20))
 ,[European] = cast(format(@f, 'N', 'de-de') as varchar(20))

yields

raw                  standard             European
-------------------- -------------------- --------------------
          123456.789 123,456.79           123.456,79

Upvotes: 6

Related Questions