I have a select command to select and insert into a variable with table data type from a dynamic table.
declare @RegisterNumber table(RegNo bigint);
insert into @RegisterNumber (RegNo) (select RegisterNo from
dbo.Student )
This command works fine.
But I want to mention the dynamic table name it shows an error.
declare @TabName='dbo.Student';
exec('insert into @RegisterNumber(RegNo) (select RegisterNo from '+@TabName+')
Guna..............