The problem is that you're giving your column a type when you don't want it
to have. If the second last line was "message NOT NULL" you'd get exactly
what you're asking for.

On Wed, Feb 15, 2017 at 1:22 AM, Cecil Westerhof <cldwester...@gmail.com>
wrote:

> 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
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to