On 29/06/2009 2:57 PM, BareFeet wrote: > Hi, > > Is there any way in the command line to get the columns in a query > result? > > For example, given an ad-hoc SQL command, such as: > > begin; > insert into MyTableOrView select * from SomeSource; > select * from MyTableOrView join SomeOtherTableOrView where condition; > end; > > how can I get the column headers in the result? > > I know I can get the column info of a table using pragma table_info, > but I don't think that works for an ad-hoc query. >
SQLite version 3.6.14 Enter ".help" for instructions <<<=== ever noticed this before? Enter SQL statements terminated with a ";" sqlite> .help [snip] .header(s) ON|OFF Turn display of headers on or off [snip] sqlite> select 1 as one, 2 as two; 1|2 sqlite> .header on sqlite> select 1 as one, 2 as two; one|two 1|2 sqlite> select 1 as one, 2 as two, 3; one|two|3 1|2|3 sqlite> create table foo (bar int); sqlite> insert into foo values(42); sqlite> select * from foo; bar 42 sqlite> select bar as rab from foo; rab 42 sqlite> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users