Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql column not wide enough.
Message
From
17/11/1998 15:35:09
 
 
To
17/11/1998 15:24:36
George Lee
Microcomputer Engineering Services, Llc
Huntington Beach, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00158450
Message ID:
00158484
Views:
23
George,

I see you got the answer, but no one told you WHY.

In case you are interested, VFP SQL (and maybe all of them for all I know), will, on a "calculated field", use the first calculated instance of that field to set the length for that field.

So, for instance, if you have a calculated numeric field and the FIRST result is, say " 5.0 ", then that is the length that will be allocated, even if the majority of results would contain something more along the lines of " 9999.999 ".
In your case I guess the field in question has a length of 1 char and that the first one doesn't meet the IIF condition.

Cheers,

Jim N


>>>>I want to have an SQL statement that will allow an IIF that can accept up to 2 digits.
>>>>
>>>>
>>>>
>>>>SELECT *, ;
>>>> IIF( INLIST( nUserSecurityLevel, 1, 2, 3 ), nUserSecurityLevel+00, 99 ) AS ; nUserLvl ;
>>>> FROM ;
>>>> UserSecurity
>>>>
>>>>
>>>>Excellent. Thank you for your 34 second response :).
>>>>
>>>>Dan
>>>
>>>Sorry about the blank post.. How would I handle it if the above used characters instead.
>>>'A', 'B', 'C' and "ZZ".
>>>
>>>Dan
>>
>>'A ', 'B ', 'C ' and "ZZ"
>
>I tried that and it didn't seem to work. But when using the same idea as above for the number that fixed the problem.
>
>"<"pre">"
>
>SELECT *, ;
> IIF( INLIST( cUserSecurityLevel,'A','B', 'C' ), cUserSecurityLevel+' ', 'ZZ' ) AS ; cUserLvl ;
> FROM ;
> UserSecurity
Previous
Reply
Map
View

Click here to load this message in the networking platform