PRB: Query Bases Result Set Field Size On Non-Included Values (169791)
The information in this article applies to:
- Microsoft FoxPro for MS-DOS 2.0
- Microsoft FoxPro for MS-DOS 2.5
- Microsoft FoxPro for MS-DOS 2.5a
- Microsoft FoxPro for MS-DOS 2.5b
- Microsoft FoxPro for MS-DOS 2.6
- Microsoft FoxPro for MS-DOS 2.6a
- Microsoft FoxPro for Windows 2.5
- Microsoft FoxPro for Windows 2.5a
- Microsoft FoxPro for Windows 2.5b
- Microsoft FoxPro for Windows 2.6
- Microsoft FoxPro for Windows 2.6a
- Microsoft FoxPro for Macintosh 2.5b
- Microsoft FoxPro for Macintosh 2.5c
- Microsoft FoxPro for Macintosh 2.6a
- Microsoft Visual FoxPro for Macintosh 3.0b
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q169791 SYMPTOMS
A query may result with truncated values in an expression columns.
CAUSE
The expression column is basing its width on the first record value of the
source table.
RESOLUTION
Change the expression to use an IIF() function that returns a value of
necessary width. This forces FoxPro to create a column wide enough to hold
the results of the expression column. NOTE: The example code uses the table
created at the bottom of this article in the MORE INFORMATION section.
Here's an example:
SELECT *, IIF(ISNULL(fld2),SPACE(15),TTOC(fld2,1)) AS test ;
FROM temp WHERE fld2 is NOT NULL
-or-
Change the source table's order so that the first record's value in the
source table is wide enough to hold the expression columns output. An index
order cannot be used here, since FoxPro opens the source table in another
workarea. Using an additional query can do this. Here's an example:
SELECT * FROM temp ORDER BY fld2 DESCEND INTO CURSOR temp2
SELECT *, TTOC(fld2,1) AS test FROM temp2
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbprb KB169791 kbAudDeveloper |
---|
|