SQLite version 3.22.0 2018-01-02 18:11:11
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .head on
sqlite> .mode col
sqlite> create table x(a int_date);

sqlite> pragma table_info(x);
cid         name        type        notnull     dflt_value  pk
----------  ----------  ----------  ----------  ----------  ----------
0           a           int_date    0                       0

create view if not exists SysColumns
select ObjectType collate nocase,
       ObjectName collate nocase,
       ColumnID collate nocase,
       ColumnName collate nocase,
       Affinity collate nocase,
from (
        select ObjectType,
               cid        as ColumnID,
               name       as ColumnName,
               type       as Affinity,
               "notnull"  as IsNotNull,
               dflt_value as DefaultValue,
               pk         as IsPrimaryKey
          from SysObjects
          join pragma_table_info(ObjectName)

sqlite> select * from SysColumns where ObjectType = 'table' and ObjectName = 
ObjectType  ObjectName  ColumnID    ColumnName  Affinity    IsNotNull   
DefaultValue  IsPrimaryKey
----------  ----------  ----------  ----------  ----------  ----------  
------------  ------------
table       x           0           a           int_date    0                   

The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Bart Smissaert
>Sent: Saturday, 6 January, 2018 10:45
>To: General Discussion of SQLite Database
>Subject: [sqlite] sqlite3_column_decltype and max and min
>Is there any way with sqlite3_column_decltype (or otherwise) to get
>declared data type (as in the table create sql in SQLite_master) when
>it is
>a simple expression such as max and min?
>for example we have a table created like this:
>create table1([integer_date] int_date)
>and we do:
>select max(integer_date) from table1
>I would then like to get returned int_date, rather than integer.
>The custom datatype int_date is needed for formatting purpose to tell
>app that receives
>the data that the column holds dates as integers.
>To do this in application code is not that simple, so I hope there is
>simpler way.
>sqlite-users mailing list

sqlite-users mailing list

Reply via email to