Author |
Topic |
mike13
Posting Yak Master
219 Posts |
Posted - 2013-06-19 : 14:54:51
|
Hi All,I got a nvarchar field that has these wierd chars in them?????????Ho can i just do a simple update replace.Tried this, but didn-t workUPDATE T_textblocksSET textblock=Replace(textblock,'?','')tnx a lot |
|
mike13
Posting Yak Master
219 Posts |
Posted - 2013-06-19 : 15:05:45
|
seems pasting into the forum it lost its form.it looks like this |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-06-19 : 17:11:30
|
If it happens to be a single funny character (or a few), you can find what those are and then replace like this:DECLARE @x VARCHAR(32) = 'abc'+CHAR(222) + 'efg';SELECT @x,LEN(@x), CAST(@x AS VARBINARY);SET @x = REPLACE(@x,CHAR(0xDE),'');SELECT @x,LEN(@x), CAST(@x AS VARBINARY); But if the characters that you want to remove are all over the place, and you know what you want to retain, you will need to write a while loop - there is an example here: http://sqljourney.wordpress.com/2010/07/13/sql-server-remove-nonalphanumeric-special-characters-column/ |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-06-19 : 18:13:17
|
The column, more than likely, doesn't have ?????? in them. The way SSMS displays the value from that column dispalys as ?????? due to the font not being able to display those characters. Try changing the SSMS font to a good unicode font. |
|
|
mike13
Posting Yak Master
219 Posts |
Posted - 2013-06-21 : 04:54:03
|
Hi Tried it but didn't work.look:Also tried the loop from the site you gave me, didn't work alsoalso has nothing todo wit the ssms, because it show it also in the html pages etcanyone, has a clue how to fix this? |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-06-21 : 08:31:03
|
Post the text for a sample string (similar to what you did in the image you posted on 06/19/2013 : 15:05:45), and also post the varbinary for that same string usingSELECT CAST(YourString AS VARBINARY) Make it a short string which demonstrates the problem.Image in your posting of 06/21/2013 : 04:54:03 is not visible. |
|
|
mike13
Posting Yak Master
219 Posts |
Posted - 2013-06-21 : 17:18:13
|
Hi James,I fixed the image.And here is the result of the query |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-06-21 : 17:36:55
|
*facepalm* Char(63) is a questionmark. |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-06-21 : 17:59:31
|
I'm not sure of your actual issue, but the character you are trying to represent is 65533 in unicode:SELECT NCHAR(65533)select unicode(NCHAR(65533)),Unicode(N'?')RESULTS----------- -----------65533 63 |
|
|
|