General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only