Thomas
Thomas

Reputation: 34188

How to find & remove space from a column value in sql server

i have table and there is one field where i store huge html document. each html document has many url. by mistake when html data was inserted into table then there was some space stored in url like

www.mysite.com/content.aspx?id=audi 2000 
rather it should be  www.mysite.com/content.aspx?id=audi2000 

so when user click on the link then no page is showing. there are huge data is stored with same space problem in url. so just guide me which sql query i should use to remove those space as result my url should look like

www.mysite.com/content.aspx?id=audi2000 or
www.mysite.com/ content.aspx?id=audi2000 it should www.mysite.com/content.aspx?id=audi2000

so just guide me. thanks

Upvotes: 0

Views: 4501

Answers (1)

Raphaël Althaus
Raphaël Althaus

Reputation: 60493

you could use replace

replace(yourcolumn, ' ', '')   

eg:

update tableName set columnName = Replace(columnName,' ','') -- where id = 2595

Upvotes: 2

Related Questions