I have one table named AskLists with 2 fields :
AskListId AskInterview
2032 5
2032 3
2032 4
2032 6
5076 1
5076 3
5076 4
5076 5
5076 6
For each distinct number of the field AskListId, there is a table named by the number AskList'Number' For example AskList5076 :
AskInterview QUOTA7
1 5660424
2 5660424
3 5660424
4 5667511
5 5667511
6 5667511
7 5667511
So there are hundred of tables AskList'Number'.
I am trying to add the field QUOTA7 which we can find in every AskList'Number' table to the main table AskLists.
For one table, it's easy :
SELECT AskListId
, AskInterview
,AskList5076.QUOTA7
FROM [Lists].[dbo].[AskLists]
INNER JOIN AskList5076 on AskLists.AskInterview = AskList5076.AskInterview
But I need to make it for all the values inside AskListId...
Is it possible to make it without making manually hundred of requests ?
I was told Dynamic SQL could make it but I don't know about it.