Something to keep in mind... and love to hear your thoughts on this one.
There're two types in MSSQL to store your byte array,
- BINARY, fixed length
- VARBINARY, flexible with a max of 8000. (if you want bigger -> BLOB)
As I want to store my generated SHA1 key in a Binary format
- The bytes array size, hashSHA1.length = 20.
- Define column size HUB_KEY with a length/size of 20, type BINARY.
But, when inserting the records, an error occured:
java.sql.BatchUpdateException: String or binary data would be truncated.
I took a closer look at the create table statement in the java-code, see attached picture
There's no size added to the BINARY statement. I think this is a bug...
Changed to VARBINARY and (20) is added to the CREATE statement.
it really not important - for any from 6.4 - 7.01 it create binary without length not depending from schema (not only for MS SQL)
if You on subscription version - open issue (still would be very long)
in other case - just not use create if not exists and create tables in advance