Working with the VARCHAR data type (SQL Server)

When invoking the VARCHAR data type in SQL Server, you must distinguish between the varchar and text Guidewire data types. SQL Server has two alternatives for invoking the VARCHAR data type:
  • VARCHAR(N) where N is a number of bytes less than 8000
  • VARCHAR(MAX) where MAX represents a number of bytes equal to 231-1 or 2 gigabytes
These alternatives correspond respectively to the varchar and text Guidewire data types.

If you intend to create a variable that can have a size in excess of 8000 bytes, you cannot use the varchar Guidewire data type. Doing so will result in a VARCHAR(N) invocation in SQL Server. In this case, Guidewire Studio will allow you to set the variable to a value that exceeds 8000 bytes. The development environment will not provide a warning or error message. Instead, Guidewire Studio will throw an exception on the next server startup.

You must use the text Guidewire data type if you intend to create a variable that can exceed 8000 bytes in size. Using the text Guidewire data type will result in a VARCHAR(MAX) invocation in SQL Server. This invocation will provide the variable access to 2 gigabytes of storage.