Overriding the maximum value of a bigint datatype in SQL Server

Go To StackoverFlow.com

3

Could a database administrator override the largest value that a bigint datatype could hold (making it smaller than what is listed in the documentation)?

2012-04-03 23:12
by Elliott


7

Yes, you could put a check constraint on the column

example

ALTER TABLE SomeTable
ADD CONSTRAINT chkMaxValue CHECK (SomeCol < 123456 );
GO

You could also use a trigger to restrict it but that is overkill

2012-04-03 23:14
by SQLMenace


4

no, but you can create a check yourself so values wont exceed a certain value, like this:

create table test_bigint(
my_value bigint check (my_value <100)
)
2012-04-03 23:16
by Diego
Ads