Replace input with space

How can I replace "Enter" in one of the fields in the database with a space

Actually, I tried the codes below in vb.net, but not working for them for me,

address = Replace(address, System.Environment.NewLine, " ") 

or

 address = Replace(address, vbNewLine, " ") 

or

 address = Replace(address, Chr(13), "") 

Language: Vb.net Database: MSSQL 2005

Thank you in advance

+4
source share
2 answers

If you want to replace newline characters in SQL-Server.

  • Line Channel - CHAR (10)
  • Carriage Return - CHAR (13)

So, if you want to update the column and replace NewLines with white spaces:

 UPDATE TableName SET address=REPLACE(REPLACE(address, CHAR(13),' '), CHAR(10),' '); 
+10
source
  • Line Channel - CHAR (10)
  • Carriage Return - CHAR (13)
  • CHAR Tab (9)

    REPLACE (REPLACE (REPLACE (address, CHAR (13), ''), CHAR (10), ''), CHAR (9), '')

0
source

Source: https://habr.com/ru/post/1447435/


All Articles