views:

8

answers:

1

Hello,

So I basicly have a table which has a list of table names. All these listed tables have exact same structure.

Then I have a query template, with place holder for table name.

I need to create a view, which should return results of that query UNIONed from all the tables listed in that one setup table.

So far what I've done is create a user defined function, which would prepare a complete UNIONed SQL statement.

But this is where I'm stuck. I can't figure out how to execute it in a view and return whatever it returns..

A: 

My function returns SQL syntax.

I figured that UDF can't executed dynamic sql, so my method won't work. So far I've solved my issue at hand by generating views. But I would still prefer a more dynamic way..

mrQQ