Declare @table nVarchar(1000)
set @table = 'select * from ' + @table_name
exec(@table)
Run Store Procedure
Exec select_table_dynamic 'table_name'
Run Store Procedure
Exec select_table_dynamic 'table_name'
Before go in for export,just configure ur Database Driver With the Given Code Below.
EXEC sp_configure 'show advanced options', 1;
Below Code is used to Export Sql Data into Excel Format