I am trying to use T-SQL (in SQL Server 2012) stored procedures to pass a parameter to be part of table name but am getting an error.
Example
CREATE PROCEDURE test_proc
@year NVARCHAR(4)
AS
BEGIN
UPDATE Tablename@yearABC
.....
They if I call the procedure with the parameter value 2017, I want it to update Tablename2017ABC
Can anyone explain how use stored procedures (or other T-SQL) to use the parameter as part of a table name?
Thanks