With the eval() function loaded,

sqlite> select tbl_name, eval('select count(*) from ' || tbl_name) from 
sqlite_master where type='table';
advisory|10
advlink|67528
crew|144809
crewlink|1710151
genre|201
genrlink|703470
lineup|4
map|646
program|447534
role|14
schedule|162272
station|493
mySeries|310
myChannels|262
sqlite_stat1|32
sqlite_stat4|1481
myTitles|27203

The eval function is found in ext/misc/eval.c of the source distribution (not 
the amalgamation) in file eval.c

http://www.sqlite.org/src/info/27cf665b957f2c0ced403e3032099e80c295598f
http://www.sqlite.org/src/artifact/04e630bde869aa1fec6b993d40591f963be2f868


---
Theory is when you know everything but nothing works.  Practice is when 
everything works but no one knows why.  Sometimes theory and practice are 
combined:  nothing works and no one knows why.

>-----Original Message-----
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of Paul Sanderson
>Sent: Monday, 17 November, 2014 03:55
>To: General Discussion of SQLite Database
>Subject: [sqlite] Column name as a variable
>
>Is it possible to get a row count for each of the tables in a database
>using a SQL query.
>
>i.e.
>
>is there a way I could use each row in sqlite_master and use
>table_name to somehow do a select count(*) from
>sqlite.master.table_name
>
>Thanks
>
>
>Paul
>www.sandersonforensics.com
>skype: r3scue193
>twitter: @sandersonforens
>Tel +44 (0)1326 572786
>http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-
>Toolkit
>-Forensic Toolkit for SQLite
>http://sandersonforensics.com/forum/content.php?168-Reconnoitre - VSC
>processing made easy
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to