Does SQL have a number separator (like an underscore) to split up large number literals

Viewed 76

I'm trying to make it easier to read some SQL code where we need to hardcode in some large numbers

I'd like to do something like this:

SELECT 3_800_000

Which, according to this post, is really treated like this:

SELECT 3 _800_000
SELECT 3 AS [_800_000]

JS allows numeric separators

let x = 1000000000000
let y = 1_000_000_000_000
console.log(x==y) // true

Also, C# added digit separators in 7.0 as well

// These are equivalent.
var bigNumber      = 123456789012345678;
var bigNumberSplit = 123_456_789_012_345_678;

Is something similar possible in T-SQL?

Note: I'm not looking for a way to format the output, I'm looking for a way to make the source code easier to read for big numbers

1 Answers

The answer is, unfortunately (and as commenters pointed out, thanks folks), that this is not currently a feature of T-SQL.

I was not aware of those JS and C#, so thanks for that.

Related