SQL是否有一个数字分离器(例如下划线)来拆分大数字

发布于 2025-02-09 08:53:18 字数 1026 浏览 1 评论 0 原文

我正在尝试使阅读一些SQL代码更容易,我们需要在其中进行一些

我想做类似的事情的硬码:

SELECT 3_800_000

根据这篇文章真的是这样对待的:

SELECT 3 _800_000
SELECT 3 AS [_800_000]

JS允许

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

另外,c#添加数字分离器在7.0中,

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

在t-sql中也可能类似吗?

注意:我不是在寻找一种格式化输出的方法,我正在寻找一种使源代码更易于阅读的方法

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怼怹恏 2025-02-16 08:53:18

不幸的是,答案是(正如评论员指出的那样,感谢人们),这不是当前T-SQL的功能。

我不知道那些JS和C#,所以谢谢。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文