Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 FindTrainlingWhitespacesinColumn

Author  Topic 

velliraj
Yak Posting Veteran

59 Posts

Posted - 2008-11-20 : 05:05:39
Anyone please help me out on this prob.

we,ve a table with all the names stored, i need to find the names stored with trailing whitespaces in a column that creates prob when retrieving docs.

plz help

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-11-20 : 05:08:23
You can use rtrim(yourcolumn) to retrieve docs.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

velliraj
Yak Posting Veteran

59 Posts

Posted - 2008-11-20 : 05:15:18
But i need to correct the master data, it is stored in the form of path that creats prob.
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-20 : 05:25:48
post the kind of data you have and the correction you need to make.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-20 : 05:43:26
surely,

UPDATE <yourTable> SET
<yourColumn> = RTRIM(<yourColumn>)


Is all you need. (That is if there should be no trailing whitespace whatsoever on the column)


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

velliraj
Yak Posting Veteran

59 Posts

Posted - 2008-11-20 : 08:58:57
Tks for the valuble info, but here i need to pick the records watever its going to update( we need to get a report of all the clients with whitespaces)
Go to Top of Page

acollins74
Yak Posting Veteran

82 Posts

Posted - 2008-11-20 : 10:31:08
Try this.

Select * from yourTable
where datalength(yourColumn) > datalength(rtrim(yourColumn))
Go to Top of Page

velliraj
Yak Posting Veteran

59 Posts

Posted - 2008-11-20 : 12:33:05
This is perfect, i thank lot in reducing my r&d.
Really good.
Go to Top of Page
   

- Advertisement -