Hi All, I am using MS SQL 2005 and I have a table called ipAssets in which there is a column called fileName (varchar(30)). This column value is used to build path statements which we then use to access the file whose name is in this column. Some of the values for the file names in this column contain one or more spaces before the file name itself which causes the path to be invalid and things break down from there.
e.g. ' myFile.jpg' which causes the path .../someplace/somefolder/ myFile.jpg which is a bad path.
I would like to find out how many records in ipAssets have been affected by this, and I also want to know how to safely remove the extra spaces from those records. I have researched this and found some trim functions that appear to sound right for the job (LTRIM and RTRIM) but I am not sure if using these is the correct approach, or if there is a better (safer) way to do both items above. Any help would be greatly appreciated.THANKS!
asked Jul 25 '10 at 06:12 AM in Default
As you've found, using LTRIM(RTRIM(columname)) will do the job quite nicely.
To find out how many records are affected:
What you might want to do is clean your data by:
answered Jul 25 '10 at 07:09 AM