tags:

views:

749

answers:

4

I tried

UPDATE TABLENAME SET COLUMNNAME = REPLACE(COLUMNNAME, '\t', '')

But I don't know how to write the TAB in t-sql

+3  A: 

The ASCII code for tab is 9; you could try

update tablename set columnname = replace(columnname, char(9), '')
Adrien
+1  A: 

I found the solution:

I T-SQL you do not escape characters, you paste or type them directly into the quotes. It works even for \r\n (carriage return, new line = you press enter)

Jader Dias
I would advise caution with this. Six months down the line, are you going to remember what all of those blank spaces wrapped in single-quotes are for?
Adrien
A: 

You can put a tab character in the string, just press the tab key.

That will work, but it's not very readable.

Guffa
+2  A: 

In the beginning of my TSql sProcs, I often put

   Declare @NL Char(2)  Set @NL  = Char(13) + char(10)
   Declare @Tab Char(1) Set @Tab = Char(9)
   etc...

Then you can use those declared variables anywhere in the rest of the proc without loss of clarity...

Charles Bretana