On Sat, 27 Feb 2010 13:46:28 -0500, "ve3meo"
<holden_fam...@sympatico.ca> wrote:

>Is there a way to use SELECT against the PRAGMA result-set?
>
>This returns an error:
>SELECT * FROM (PRAGMA table_info(tablename)); 

With the command line tool, you can:

sqlite> create table  pti(
   ...> cid,name,type,not_null,dflt,pk
   ...> );
sqlite> .separator ,
sqlite> .head off
sqlite> .output x.sql
sqlite> PRAGMA table_info(yourtable);
sqlite> .output stdout
sqlite> .import x.sql pti
sqlite> select * from pti;
0,nkey,INTEGER,0,,1
1,catg,TEXT,0,,0
2,mesg,TEXT,0,,0

Put these commands in a file and feed it to sqlite.

--- tableinfo.sql ---
create table  if not exists pti(
cid,name,type,not_null,dflt,pk
);
delete from pti;
.separator ,
.head off
.output x.sql
PRAGMA table_info(yourtable);
.output stdout
.import x.sql pti
---

$ sqlite3 yourdb <tableinfo.sql

Hope this helps.
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to