View Full Version : TRIM Function

04-09-2007, 10:37 PM
Hi there...

My column from a table in sql has value "NEW" and sometimes "NEW ".....thats with 2 spaces behind it...

How do i get rid of it in my sql or asp....someone suggested TRIM??


mysql="SELECT * FROM Test WHERE number='10'"
Set rs= Con.Execute( mySQL )

if rs("status")="NEW" then
end if

04-09-2007, 10:43 PM
Is there ever a time where you want spaces trailing non-spaces in that column? If not, then you can just do a mass UPDATE query to trim every row:

UPDATE myTable
SET myColumn = RTRIM(myColumn)

04-09-2007, 10:54 PM
Sorry I think this should have been as asp question...

Coz its not the update thats causing problem but its retrieving value from the database tht might sometimes have "NEW" or "NEW ". So i should probably do something in asp to get rid of those 2 spaces in my condition of if..else..end if...

What say??

04-09-2007, 11:28 PM
My suggestion was to execute a one-time query that will clean up the data in your table, but if you want to prevent the extra spaces from ever being written to the table, you'll want to ask for this thread to be moved to the ASP forum so someone can help you with that.