SQL Server T-SQL 中的整数最大值常量? [英] integer Max value constants in SQL Server T-SQL?

查看:32
本文介绍了SQL Server T-SQL 中的整数最大值常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

T-SQL 中是否有任何常量,就像其他一些语言中提供的数据类型(如 int)的最大值和最小值范围一样?

Are there any constants in T-SQL like there are in some other languages that provide the max and min values ranges of data types such as int?

我有一个代码表,其中每一行都有一个上下范围列,我需要一个条目来表示一个范围,其中上限是 int 可以容纳的最大值(有点像黑客无穷大).我不想对其进行硬编码,而是使用诸如 SET UpperRange = int.Max

I have a code table where each row has an upper and lower range column, and I need an entry that represents a range where the upper range is the maximum value an int can hold(sort of like a hackish infinity). I would prefer not to hard code it and instead use something like SET UpperRange = int.Max

推荐答案

有两个选项:

  • 用户定义的标量函数
  • 属性表

在 Oracle 中,您可以在包中执行此操作 - 最接近的 SQL Server 是程序集...

In Oracle, you can do it within Packages - the closest SQL Server has is Assemblies...

这篇关于SQL Server T-SQL 中的整数最大值常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆