I tried
UPDATE TABLENAME SET COLUMNNAME = REPLACE(COLUMNNAME, '\t', '')
But I don't know how to write the TAB in t-sql
Declare @nl Char(2) = char(13) + char(10) Declare @tab Char(1) = char(9) etc... Then you can use those declared variables anywhere in the rest of the proc without loss of clarity...
SQL Trim Function Another function you can use to remove characters from a string is the trim() function. The trim function will remove all leading and trailing whitespace characters from a string by default.
Names can contain (but cannot begin with) the following special characters: 0 through 9, #, @, and $.
The ASCII code for tab is 9; you could try
update tablename set columnname = replace(columnname, char(9), '')
For TAB
and ENTER
SELECT
-- TRIM AND REPLACE `TAB` AND `ENTER`
LTRIM(RTRIM(
REPLACE(
REPLACE(
REPLACE(columnname, CHAR(9), ' '),
CHAR(13), ' '),
CHAR(10), ' ')
))
In the beginning of my TSql sProcs, I often put
Declare @nl Char(2) = char(13) + char(10)
Declare @tab Char(1) = char(9)
etc...
Then you can use those declared variables anywhere in the rest of the proc without loss of clarity...
You can put a tab character in the string, just press the tab key.
That will work, but it's not very readable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With