Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL equivalent to VAL not working
Message
From
14/08/2006 11:25:56
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01144926
Message ID:
01145329
Views:
19
Yes. :0)
SELECT CAST(LEFT(Number, PATINDEX('%[-,/\@#$%^!&*()+A-Z]%', Number + 'A')-1) AS int), Number FROM 
occ_main WHERE CAST(LEFT(Number, PATINDEX('%[-,/\@#$%^!&*()+A-Z]%', Number + 'A')-1) AS int) BETWEEN 300 and 315
>Tracy,
>
>It will indeed work. Both, what you have there and what I posted do the same thing. I was confused about what the solution below was accomplishing exactly. Although, shouldn't your query below use the same pattern in both the select and where clauses?
>
>Chad
>
>>This seems to work:
>>
>>SELECT CAST(LEFT(Number, PATINDEX('%[-,A-Z]%', Number + 'A')-1) AS int), Number FROM occ_main
>>   WHERE CAST(LEFT(Number, PATINDEX('%[-,/\@#$%^!&*()+A-Z]%', Number + 'A')-1) AS int) BETWEEN 302 AND 390
>>
>>I updated number in the table so that a few records contained the value of 311-3B or 308A in the number field and when I ran the above query it returned them as well as 302-309 plain values.
>>
>>It returned:
>>
>>
>>(no column name)   number
>>302                  302
>>308                  308A
>>311                  311
>>311                  311-3B
>>312                  312
>>308                  308
>>
>>Etc which is correct.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform