Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL equivalent to VAL not working
Message
De
14/08/2006 12:05:51
 
 
À
14/08/2006 06:52:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01144926
Message ID:
01145348
Vues:
18
Thank you for the ideas Fabio.


>>I need to pull a range of records based on the street number. The number field is character. The problem occurs when a letter was entered in the number field as well as in 300A, 3505B, etc. Both of the examples below return the error:
>>
>>Conversion failed when converting the varchar value '3505A ' to data type int.
>>or:
>>Error converting data type varchar to numeric.
>>
>>
>>select * from omain where 1100 < number and 3000 > number
>>select * from omain where cast((number) as decimal(10,0)) > 1000 and cast((number) as decimal(10,0)) < 3000
>>
>>
>>Recommendations?
>
>Better if you uses one or more LIKE pattern,
>you have a chance to optimize it with a index on the number field
>
>select 'FOUND' WHERE '201-1AB' LIKE '[12][-0-9][-0-9][-0-9]%'
>
>
>To extract numbers from a string and to use them as a filter it is not a good design.
.·*´¨)
.·`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"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform