all groups > sql server programming > october 2003 >
You're in the

sql server programming

group:

Trim String


Trim String freger
10/26/2003 9:20:46 PM
sql server programming: Hi,

I have a column in an SQL table which i would like to trim
the spaces between string.

e.g EV 21 to EV21

Can anyone tell me how to do it manually. I know i can do
it automatically in DTS. But I would like to do an one-off
from the query analyzer. Can someone tell me.

Thank you.

Re: Trim String sampangi
10/26/2003 9:30:14 PM
Does this work?

UPDATE MyTable
SET MyColumn = REPLACE(MyColumn,' ','')

Srinivas Sampangi

[quoted text, click to view]

Re: Trim String Freger
10/27/2003 12:02:31 AM
Hi Srinivas,

It doesn't work because it is many the whole column i want
to trim. From the solution you suggested, i seem to have
to do it record by record.

Any other suggestions?

Freger
[quoted text, click to view]
Re: Trim String Tibor Karaszi
10/27/2003 9:17:25 AM
[quoted text, click to view]


No, what lead you to believe that. The solution Srinivas posted will modify all rows in the table
(as it doesn't have a WHERE clause).

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: Trim String Freger
10/29/2003 1:35:46 AM
Hi Tibor and Srinivas,

Thank you very much. Apologise for misunderstood Srinivas
instruction.

I've tried and it works.

Freger
[quoted text, click to view]
AddThis Social Bookmark Button