Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Ltrim rtrim no working with UPDATE Expand / Collapse
Author
Message
Posted Monday, February 23, 2009 6:54 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,102, Visits: 6,933
And this should correct the data....

UPDATE #tablename 
SET colname = STUFF(colname,1,1,'')
WHERE colname LIKE '%WDT'
AND colname <> 'WDT'




Far away is close at hand in the images of elsewhere.

Anon.

Post #662526
Posted Monday, February 23, 2009 6:56 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, June 20, 2013 2:04 AM
Points: 222, Visits: 331
I have a space on the right side so changed the query accordingly . but afraid it shows no records.

SELECT DISTINCT
[Code] = ASCII(right(LTRIM(valuecode), 1)),
[Character] = '[' + right(LTRIM(valuecode), 1) + ']'
FROM ListOfValues
WHERE (valuecode LIKE '%WDT%')
-- 32 ,[ ]

SELECT valuecode,CAST(valuecode as varbinary(4))
FROM ListOfValues
WHERE valuecode LIKE 'WDT%'
AND valuecode <> 'WDT'
-- No Records



Sriram

Post #662527
Posted Monday, February 23, 2009 7:01 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,102, Visits: 6,933
You need to do

LIKE '%WDT'

not

LIKE 'WDT%'



Far away is close at hand in the images of elsewhere.

Anon.

Post #662534
Posted Monday, February 23, 2009 7:08 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, June 20, 2013 2:04 AM
Points: 222, Visits: 331
Yes David, I have done that rather tried both 1st time only, it returned no records.

Sriram

Post #662542
Posted Monday, February 23, 2009 7:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,102, Visits: 6,933
OK. Maybe there are trailing non printable chars as well, should have thought of that .

Try

LIKE '%WDT%'




Far away is close at hand in the images of elsewhere.

Anon.

Post #662565
Posted Wednesday, February 25, 2009 2:17 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, June 20, 2013 2:04 AM
Points: 222, Visits: 331
Thanks for you time friends. could not solve the issue, updated the col to varchar datatype.

Thanks again.


Sriram

Post #664078
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse