Nothing with just SQL alone, although you can get close:

http://www.sqlite.org/faq.html#q7

You could use a command pipeline, but that only works if the table has
at least one record:

$ sqlite3 -separator ", " -header sample.db 'select * from
sqlite_master limit 1; ' |
head -1
type, name, tbl_name, rootpage, sql

Or you can do it from within a scripting language, e.g. ruby:

$ ruby -e '
require "sqlite3" ;
db=SQLite3::Database.new("sample.db") ;
row=db.execute2("select * from sqlite_master limit 0 ") ;
puts row.join(", ") ;
'
type, name, tbl_name, rootpage, sql

Good luck and let us know what works for you.

Regards,
- Robert

On Tue, Jan 12, 2010 at 6:27 AM, Oliver Peters <oliver....@web.de> wrote:
> Hello out there,
>
> is there a quick way to get a comma separated list of column names as a 
> result of a query?
> (I couldn't find a PRAGMA or a dot command for this).
>
> Example:
>
> col01,col02,col03
>
>
> Greetings
> Oliver
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to