I am reading some data from a database table and the text contains the '/' character.
I now need to insert this string into a different SQL table but I'm having problems escaping it correctly.
If the string I read contains this pattern:
Test/test2
After some google searching, I am using to insert the text (google refs Ref1 and Ref2)
Field1= replace (cast('Test/th' as nvarchar),'/','\\\')
But it still returns the error:
Msg 8152, Level 16, State 2, Line 18 String or binary data would be truncated.
If I use:
Field1= replace (cast('Test/th' as nvarchar),'/','')
Everything is fine
Can anyone help me with my escape clause please?