-
Erland Sommarskog 72,971 Reputation points MVP
2022-01-24T23:14:50.473+00:00 I agree with Freddy. The Docs page is absolutely in error. Commas are ignored anywhere in the specified money literal. is plain wrong. You cannot have commas at all in a money literal. You can have commas in a string that you convert to money, but that's something else.
In the upper right of the page, there is a pen icon that will take you to the Github repro for the Docs. If you are brave you can edit the page directly and submit a pull request. It may be better to submit an issue and let the writers work it out. (If you submit a pull request, it will be reviewed.)
3 additional answers
Sort by: Most helpful
-
Viorel 89,396 Reputation points
2022-01-24T09:06:16.517+00:00 Probably "every three digits in strings" means string constants, for example:
SELECT $1000 + '$123,4'
SELECT cast('$123,4' as money)Tom Phillips 17,621 Reputation points2022-01-24T14:08:37.467+00:00 SELECT $123,4 is 2 columns.
That quote is referring to thousands separator in money data types.
SELECT CAST('$123,456.78' AS MONEY)
Olaf Helper 27,306 Reputation points2022-01-24T11:11:04.607+00:00 The conversion works if you do it the right way:
select CONVERT(money, '$ 123.4'); select CONVERT(money, '€ 123.4'); select CONVERT(money, '£ 123.4'); select CONVERT(money, '¥ 123.4');
-
SQL Server money constant syntax

Hi,
in the page https://learn.microsoft.com/en-us/sql/t-sql/data-types/constants-transact-sql?view=sql-server-ver15 it's specified that
--------------------
SQL Server does not enforce any kind of grouping rules such as inserting a comma (,) every three digits in strings that represent money.
Commas are ignored anywhere in the specified money literal.
--------------------
I don't use SQL Server on a daily base but I never used such syntax with commas, so I tried with an instance a simple query like "SELECT $123,4" and, as my expectation, it returns 2 columns, not one. So I suspect commas are not supported and so the notes about grouping and commas being ignored are wrong in the documentation.