Search code examples
sqlsql-servervarbinaryvarbinarymax

How can I create a SQL varbinary of size greater than 8000 bytes?


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?


Solution

  • 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.