Does anyone know how to write a script in stored proc to run the table based on the variable (or will it possible to do so?)?
for example: I have 3 tables name called customer, supplier, and support
when user input 1, then run table customer, 2 table supplier and 3 table support
declare @input int;
if @input =1
begin
declare @table varchar(50); set @table = 'customer'
end
if @input =2
begin
declare @table varchar(50); set @table = 'supplier '
end
if @input =3
begin
declare @table varchar(50); set @table = 'support'
end
select *
INTO ##test
from @table