When I try to make a calculated field [File HASH] using hashbytes('MD5',[ASCII File]) the calculation I get the resultant field [File HASH] as a nvarchar(max)I want the field [File HASH] to be nvarchar(50) so I tried left(hashbytes('MD5',[ASCII File]), 50) figuring if I only take the left 50 characters then the resultant field would only be 50 charactersWhen I try to do a select query using including the [File HASH] field I get Query completed with errorsMsg 8152, Level 16, State 10, Line 2String or Binary data would be truncated So I tried instead of using the [File HASH] calculkated field directly I tried using left(hashbytes('MD5',[ASCII File]), 50) in the select instead of the calculated field and I get the same error messages.How can I take the HASHBYTES of a nvarchar(max) field and put the result in a another field that is nvarchar(50) BTW the MD5 HASH has is way less than 50 characters as a result.Also I am using SQL SERVER Management Studio 2016 and I modified the table using the GUI but the Queries I am using SQL.I was wondering if convert could somehow be used? If so what would be the syntax for the calculated field?
↧