Can you tell me how to insert executed variable @name in my table? I had some coding and this is what i managed to do but I do not know whats next:
DECLARE @Name nvarchar(200);
DECLARE @dbcatalog nvarchar(128);
declare @sql nvarchar(4000)
select @name = N' select ID from ' + @DbCatalog + '.dbo.Table2 ';
SET @sql = 'insert into Table2(Name) values (@name)'
exec Sp_executeSQL @sql