
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
String or binary data would be truncated
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.
Solved.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
look like a bug, what the version of Talend?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-----

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Version:
TOS_BD-20180116_1512-V6.5.1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I first had no length specified.Which resulted in this... trying to on the Binary field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can create table manually with length
then must work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Its just convenient of not having to maintain scripts.
Varbinary(20) works fine, And while reading some technical docs on performance and how search work, there's technically not much difference beside the variable length.
Thanks for sharing your thoughts!
