Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WHERE field1 + field2 + field3 = myvalue
Message
 
 
To
15/08/2006 10:01:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01145445
Message ID:
01145680
Views:
16
Hi Tracy,

Do you realy need LTRIM() on the colums? I don't think data should be stored with leading spaces.

>OK, a valid address is:
>
>5614 HIGH POINT RD
>
>This works:
>
>declare @cvalue varchar(15)
>set @cvalue = '5614'
>select * from occ_main where ltrim(rtrim(number))+ltrim(rtrim(st_prefix))+ltrim(rtrim(street))+ltrim
>(rtrim(st_type))+ltrim(rtrim(st_suffix))+Ltrim(rtrim(apt_room)) LIKE '%' + ltrim(rtrim(@cvalue)) + '%'
>
>and this works:
>
>declare @cvalue varchar(15)
>set @cvalue = 'HIGH'
>select * from occ_main where ltrim(rtrim(number))+ltrim(rtrim(st_prefix))+ltrim(rtrim(street))+ltrim(rtrim(st_type))+ltrim(rtrim(st_suffix))+Ltrim(rtrim(apt_room)) LIKE '%' + ltrim(rtrim(@cvalue)) + '%'
>
>and this works:
>
>declare @cvalue varchar(15)
>set @cvalue = '5614HIGH'
>select * from occ_main where ltrim(rtrim(number))+ltrim(rtrim(st_prefix))+ltrim(rtrim(street))+ltrim(rtrim(st_type))+ltrim(rtrim(st_suffix))+Ltrim(rtrim(apt_room)) LIKE '%' + ltrim(rtrim(@cvalue)) + '%'
>
>but this does not:
>
>declare @cvalue varchar(15)
>set @cvalue = '5614 HIGH'
>select * from occ_main where ltrim(rtrim(number))+ltrim(rtrim(st_prefix))+ltrim(rtrim(street))+ltrim(rtrim(st_type))+ltrim(rtrim(st_suffix))+Ltrim(rtrim(apt_room)) LIKE '%' + ltrim(rtrim(@cvalue)) + '%'
>
>So I guess I have to remove ALL spaces in the value entered to pull matching records. Should've figured that...
>
>(The code was cut from sql sever management studio - not vfp)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform