I want to create a varbinary(16384) but cant because the size must be a max of 8000 or MAX. I don't want to use MAX because I want an error thrown if the field size inserted is greater than 16384. Is there anyway to do this?
Asked
Active
Viewed 1,170 times
1
-
1Can you use a check constraint on size > 16384? – mellamokb May 31 '12 at 22:42
-
Well I feel like an idiot now; you should add it as solution :-) – Matt May 31 '12 at 22:44
2 Answers
1
Interesting, according to http://msdn.microsoft.com/en-us/library/ms143432.aspx the maximum size of varbinary is actually 2^31 - 1 for both 32-bit and 64-bit sql server

dplante
- 2,445
- 3
- 21
- 27
1
Use MAX. Constrain the field and handle the error in the data layer / application.
It sounds like you are trying to push data to a table, and are depending upon the SQL Server to throw back an error. IMO, this is too far 'down stream' to handle this type of thing.

JMC
- 910
- 7
- 11