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?
我认为您的列字段长度设置为6。将其更改为7。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.