I want to run a similar query at different times changing only one thing in the where clause and the table name that it's pulling from.
declare ?tablename varchar(100);
set ?tablename = 'some_table_this_time';
declare ?id int;
set ?id = 12
select * from ?tablename
where my_id = ?id
This syntax does not work in teradata. I've used the @variable syntax in other sql programs, but cannot find the correct way in teradata.
Research:
http://forums.teradata.com/forum/database/using-parameters-with-queries