Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select with CharTran()
Message
From
27/03/2001 19:13:36
 
 
To
27/03/2001 18:57:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00489235
Message ID:
00489238
Views:
84
>Hi. VFP6 - sp5. I have a database and the end-users have put the dashes in different places in the data (over the years). Example: 303-00, 30-300,3-0300. I want to use chrtran in my sql select, but the following doesn't seem to work:
>SELE * FROM mytable WHERE chrtran(myfield,'-','') = chrtran(This.Value,'-','')
>
>The reason for the "trash" data is because several of our vendors have changed the formatting of their item numbers as they have migrated to new computers.
>
>Thanks, Randy
In what way doesn't it "seem to work". Are you getting an error message?
My guess is that your use of CHRTRAN() is changing the length of the expression on each side of the equal sign. SQL will generally set the size of the expression based upon the first occurance. If my guess is right, you could use PADL() or PADR() to force each side of the equal sign to always be the same length.
Previous
Reply
Map
View

Click here to load this message in the networking platform