On Oct 3, 2007, at 12:19 PM, Scott Marlowe wrote:

On 10/3/07, Laurent ROCHE <[EMAIL PROTECTED]> wrote:

Would this work:

SELECT
'TRUNCATE TABLE ' ||
'my_schema.' ||
c.relname ||', '
FROM pg_namespace nc, pg_class c
  WHERE c.relnamespace = nc.oid
AND  c.relkind IN ('r' )
AND nc.nspname = 'my_schema'
ORDER BY relname

Or, just:

SELECT 'TRUNCATE ' || schemaname || '.' || tablename ';'
FROM pg_tables
WHERE schemname='my_schema'
ORDER BY tablename;

Erik Jones

Software Developer | Emma®
[EMAIL PROTECTED]
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to