Best way to put commas into large numbers

TSQL's FORMAT function can do that. EG

select format(1232131312342132123.2222,'0,###.##')

outputs

1,232,131,312,342,132,123.22

If you want to use a different separator, you still use , which has a special meaning in .Net format string, and then replace the , with something else. EG:

select replace(format(123445678.2222,'#,###.##'),',','_')

outputs

123_445_678.22

If you're on SQL Server 2012+, and you want to do it (without decimal places):

SELECT FORMAT(2036150, N'N0')

If you're on an earlier version, you have to jump through some hoops:

SELECT REPLACE(CONVERT(NVARCHAR(30), CAST((2036150) AS MONEY), 1), N'.00', N'')