I have an SP that logs some actions. I want to change the SP so I can use it to write to one of 3 tables so have added an input parameter @table
Within the SP is... INSERT INTO @table
I keep getting the error: Must declare the variable '@table'.
It is declared. Do I have to create a sql string and then execute that in order to make this work?
CREATE PROCEDURE dbo.WriteLog
@Type int = 0
SET NOCOUNT ON
INSERT INTO @table VALUES
(@Type, @Task, Getdate(), @Description)