# Unix Script to Drop & Truncate a Netezza tables
#!/bin/sh
# enter your database name and table name in below
dbname=exampledb
tblname=exampletbl
# use below line to drop a table
nzsql $dbanme -c "drop table $tblname"
# use below line to truncate a table
nzsql $dbanme -c "truncate table $tblname"
-----------------------------------------------------
# Unix Script to Truncate list of Netezza tables
#!/bin/sh
# enter your database name below
dbname=exampledb
table_list=`nzsql $dbane-t -c " select TABLENAME from _V_TABLE where OBJTYPE = 'TABLE' and TABLENAME like 'yourtablelistprefix_%' "`
for table_name in $table_list; do
echo "Dropping the table $table_name from database $dbname"
nzsql $dbname -c "truncate table $table_name"
done;
Subscribe to:
Post Comments (Atom)
-
Common Informatica Error Messages and the resolution: 1) ERROR 7/21/2014 5:16:25 PM READER_1_1_1 HIER_28056 XML Reader: Er...
-
How to connect to Amazon Redshift cluster using psql in a unix script and execute a sql statement? You need to first define the following...
-
Netezza datatype conversion function To convert decimal to integer use cast(value as int) in netezza: select cast(12345.30 as int) ...
No comments:
Post a Comment