I have the following table:
CREATE  TABLE messages(
    messageID   INTEGER PRIMARY KEY AUTOINCREMENT,
    date        TEXT NOT NULL DEFAULT CURRENT_DATE,
    time        TEXT NOT NULL DEFAULT CURRENT_TIME,
    type        TEXT NOT NULL,
    message     TEXT NOT NULL
);

But for some data the field message is filled with an integer. An integer
takes less room as its text representation and it sorts differently also.
Is there a way to store an INTEGER in a TEXT field? Not very important,
more nice to have.

I just created the following view:
CREATE VIEW downloadCount AS
SELECT   date                     AS Date
,        time                     AS Time
,        CAST(message AS INTEGER) AS DownloadCount
FROM     messages
WHERE    type = 'download-count'
;

-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to