I'm having a problem getting the data from the following SQL CASE statement to show
properly in a TDBGrid:
SELECT Stamp,CatID,
(CASE WHEN CatID = 0 THEN 'Info'
WHEN CatID = 1 THEN 'Warning'
WHEN CatID = 2 THEN 'Error'
WHEN CatID = 3 THEN 'Debug'
END) AS Category,
Message
FROM LogEntries
Problem: The newly created field 'Category' displays '(MEMO)' for its data
rather than the text.
Displays properly when run using 'SQLite Expert'
Any ideas?
Thanks
Using CASE statement in a SELECT
Re: Using CASE statement in a SELECT
Hello,
When using the CASE construction,aggregate functions, etc., SQLite returns field type as Unknown, since it cannot define the result field type, therefore we map such fields as TMemoField. To solve the problem, you can use the Data Type Mapping technology in order to explicitly specify the type, to which such fields should be mapped for DataSet
When using the CASE construction,aggregate functions, etc., SQLite returns field type as Unknown, since it cannot define the result field type, therefore we map such fields as TMemoField. To solve the problem, you can use the Data Type Mapping technology in order to explicitly specify the type, to which such fields should be mapped for DataSet
-
- Posts: 12
- Joined: Fri 20 Jan 2006 17:44
Re: Using CASE statement in a SELECT
Thank you. That did it.
Re: Using CASE statement in a SELECT
Hello,
Glad to see that the problem was solved. If you have any other questions, feel free to contact us.
Glad to see that the problem was solved. If you have any other questions, feel free to contact us.