如何用SQL將字段中的換行替換成空格?
替換SQL字段中的換行符,回車符:
1> 回車符SELECT *, REPLACE(detail, CHAR(13) , '') AS 顯示替換后的內容 FROM loginfo[sybase t-sql 語法如下:]SELECT *, str_REPLACE(detail, CHAR(13) , '') AS 顯示替換后的內容 FROM loginfo?
2>換行符SELECT *, REPLACE(detail, CHAR(10), '') AS 顯示替換后的內容 FROM loginfo[sybase t-sql 語法如下:]SELECT *, STR_REPLACE(detail, CHAR(10), '') AS 顯示替換后的內容 FROM loginfo?
3>回車換行符SELECT *, REPLACE(detail, CHAR(13) + CHAR(10), '') AS 顯示替換后的內容 FROM loginfo[sybase t-sql 語法如下:]SELECT *, STR_REPLACE(detail, CHAR(13) +CHAR(10), '') AS 顯示替換后的內容 FROM loginfo4>將回車換行符替換成UPDATE loginfo SET detail = REPLACE(detail, CHAR(13) + CHAR(10), '')注在dos \win 系列會出現 回車+換行符 CHAR(13)+CHAR(10)在unix \ linux 是換行符轉換只要把回車符char(13) 去掉就行了以下sql語句UPDATE loginfo SET detail = REPLACE(detail, CHAR(13) , '')