This is my simple procedure.....
Firstly I am just getting the value of table_name as the output and then when I try to run it 2nd time,
I get an error like this...
Server: Msg 2714, Level 16, State 6, Procedure insertReading, Line 5
There is already an object named 't' in the database.
CREATE PROCEDURE insertReading @channel INT AS
DECLARE @t VARCHAR(30)
select table_name INTO t from channel_table where id = @channel
select * from t