Hi Simon, >>>> How can I get just the column headers without all the result rows? >>> >>> Turn headers on, then perform a search which gives no results. >> >> Unfortunately, the sqlite3 command line tool does not show the >> headers >> when there are no result rows. In any case, it's nit possible to >> convert an ad hoc query (ie not known beforehand) into one that >> returns no rows. > > Add "limit 0" to the end of the select statement
That will work if it's just a simple select statement without "union" or an existing "limit" etc. But if it is a compound select or a series of commands (eg inserts then a select), then appending "limit" to the end will fail. >>> It's difficult in the command-line tool, but easy using function >>> calls >>> since there's a function call specially intended for it: >>> >>> <http://www.sqlite.org/c3ref/column_name.html> >> >> It would be great to see a pragma or built in SQL function that >> returned the column headers of a given query. > > This is only a limitation in the shell (or using sqlite3_exec); column > headers can be queried from prepared statements as already pointed > out. Yes, thanks, noted. My query/wish is to get that info from the command line. Thanks, Tom BareFeet _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users