1

Is there an equivalent to the T-SQL IF...ELSE keywords for control flow?

I'm trying to conditionally EXCHANGE tables A and B if A exists, otherwise just rename B to A. From documentation, all I'm seeing around conditional logic is to use functions within a SELECT statement.

Switch386
  • 454
  • 6
  • 19
  • ugly hack with clickhouse-client ``` clichouse-client -q "SELECT concat('EXCHANGE TABLES ',database,'.',name,' AND db1.table_B') FROM system.tables WHERE database='old_db' AND name='table_A' FORMAT TabSeparatedRaw" | clickhouse-client -q ``` but this is not transactional safe – Slach Nov 29 '22 at 12:13

0 Answers0