Insert character into SQL string
问题 I have an nvarchar column I need to insert a hyphen at fixed points within the string. The hyphen need to go between the rightmost character and the next, and again in the 3rd position from the right, such as: column value is 0000050704 and I need it to be 0000050-70-4 or value is 0555256321 and it should be 0555256-32-1 Can't see how this is done. Can anyone give me a little help? 回答1: Assuming the strings can be a variable length, you'll need to use REVERSE() or lots of nasty looking LEN()