I have a spreadsheet of data, which is basically PART_ID and SPECS. The SPECS field is a large character string which, when imported into a temporary table, is stored as NVARCHAR(255).
Example:
'Widget', 'This part needs to be heated to 400 degrees before cutting.'
The ultimate table this has to go into for our ERP system stores the SPECS as a binary field.
If I do the following, I get a binary conversion:
INSERT INTO ERP_PART_TABLE (PART_ID, SPEC)
SELECT PART_ID, CONVERT(VARBINARY(MAX), SPEC) FROM TEMP_TABLE;
However, when I then go into the ERP system, all I see is the first character, and I get a chime telling me the system encountered some weird character.
I have seen this done in past conversions with a different conversion format, such as:
INSERT INTO ERP_PART_TABLE (PART_ID, SPEC)
SELECT PART_ID, CONVERT(VARBINARY(MAX), SPEC, 1) FROM TEMP_TABLE;
However, when I try to select with that formatted conversion, I get
'Msg 8114, Level 16, State 5, Line 1 Error converting data type nvarchar to varbinary.'
I have tried a TRY_CONVERT(varbinary(max), bits, 1)
and the results came back consistently NULL.
Is there potentially some special character in my original text field that I'm not seeing? (Just for a test, I also tried selecting CONVERT(VARBINARY(MAX), 'Hello',1)
and I still get the error.)
SQL*Server 2012.