I\'m doing dynamic SQL to convert all columns in a table a string
so After after all I do
EXEC(@template);
where @template is the
You should try this while getting SEQUENCE value in a variable from the dynamic table.
DECLARE @temp table (#temp varchar (MAX));
DECLARE @SeqID nvarchar(150);
DECLARE @Name varchar(150);
SET @Name = (Select Name from table)
SET @SeqID = 'SELECT NEXT VALUE FOR '+ @Name + '_Sequence'
insert @temp exec (@SeqID)
SET @SeqID = (select * from @temp )
PRINT @SeqID
Result:
(1 row(s) affected)
1