Join many data sets

General
N/A

Join many data sets

Hello everyone, I am writing a SQL in Teradata which need to join about 40 datasets. Luckily the code for joining tables is almost the same except for changing the number in the name of datasets. How can I do this with some 'DO-LOOP' type of code to reduce the length, instead of repeating the same part 40 times? Thank you.

Jerry

1 REPLY

Re: Join many data sets

You can do that using cursors and dynamic stored procedures.