CREATE TABLE #An_Obj
(id_obj nvarchar(5),
id_category int)
CREATE TABLE #JoinTable
(
id_category int,
dbjoin nvarchar(50),
schemajoin nvarchar(50),
tablejoin nvarchar(50),
fieldjoin nvarchar(50)
)
insert into #An_Obj values ('a1',1)
insert into #An_Obj values ('b2',2)
insert into #JoinTable values (1,'mydb','dbo','db_a','id_a')
insert into...