2017-05-04 74 views
0

看看SSSMS的屏幕截圖。有一些「白色空間」。我試圖將它們更新爲0,但失敗。我想:如何處理不是空的,不能修剪的「空白」?

  1. LTRIM(RTRIM(COL_NAME))
  2. Update Where COL_NAME IS NULL
  3. 複製& '白空間' 粘貼到where條款。

數據類型是nvarchar。

isnumeric(colname)顯示它們不是數字。

cast as varbianry

0x 
0x 
0x 
0x 
0x 
0x 
0x 
0x 
0x 
0x 

enter image description here

+2

你指的是什麼專欄? –

+0

@vkp藍色的最後一列。 –

+0

如果將列轉換爲'varbinary',您會得到什麼結果? –

回答

1

你可能需要更換其他空白字符,如回車,新的生產線,以及標籤(13,10,09)的輸出。

... replace(replace(replace(col,char(13),''),char(10),''),char(9),'') 

update ... 
where nullif(ltrim(rtrim(replace(replace(replace(col,char(13),''),char(10),''),char(9),''))),'') is null