Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Partial phone number lookup
Message
From
23/01/2001 04:53:50
 
 
To
23/01/2001 04:07:05
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00467158
Message ID:
00467161
Views:
13
>i have one table of telphone numbers having mumeric field and width 7. i have an index on it no i want to seek one value out of it which is memary variable and whose lenght is 3. whats it the way of seeking left of that perticular filed
>
>for example
>
>
>i want the telephone no starting from number 516 .
>
>what is the way.
>

Best would be to store the phone number as a string C(7) rather than a number; you can then use a partial key which will match starting from the leftmost position.

A second choice would be to create an index on the STR(phonenumber,7,0); seeks against this index are treated as a string value. You have the problem of a number prefixed with 0 or of less than 7 digits being left-padded with blanks, so going back to using a character field is still preferable.

In general, a number used for substring searches which is never used in mathematical operations like phone numbers, postal codes, social security numbers and the like should be stored as strings not numbers - you can restrict data entry to digits using an inputmask. It's easier to do string concatenations to build searches or combine fields, such as an area code prefix, extension suffix or the like. You also have the option of using character entries in the phone number field - for example, I can access my internal phone system's speed dial number by prefixing the speed dial number with an '*', which can be stored in a character field; one hospital paging system I worked on required that you dialed a number, waited for a second tone, and then sent # followed by the pager # to reach a specific pager. Using a numeric field, you can't tell the difference between the number 5417 and 0005417, since both would be stored as 5417 regardless of whether you entered the leading 0s. The numeric field and character field both take up the same amount of space, too.

>please help
>thanks in advance.
>Mohammed
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform