I need to check the count of rows in a table and if the count is more than 1, i need to run an update query. Is there any way i can do it without using a bteq script in teradata sql assistant? The sequence should be something like below

  1. Select count(*) from dbname.tablename;
  2. if count(*)>0, then run update statement on dbname.tablename;
1

There are 1 best solutions below

0
On

Try this:

UPDATE dbname.tablename
SET <column>=<value> 
WHERE (SELECT COUNT(*) FROM dbname.tablename) >0;

Thanks