Overriding the maximum value of a bigint data type in SQL Server
Can a DBA override the largest value a datatype can have bigint
(making it less than what the documentation says)?
+3
Elliott
source
to share
2 answers
Yes, you could set a check constraint on a column
Example
ALTER TABLE SomeTable
ADD CONSTRAINT chkMaxValue CHECK (SomeCol < 123456 );
GO
You can also use a trigger to constrain it, but this is overkill.
+7
SQLMenace
source
to share
no, but you can create a check yourself so that the values do not exceed a certain value, for example:
create table test_bigint(
my_value bigint check (my_value <100)
)
+4
Diego
source
to share