I am trying to insert variables into SQL Server table dynamically inside a stored procedure but I'm not able to accomplish it because of the syntax. Can someone correct me what am I doing wrong in the below code. Thanks.
Code I have tried:
SET @SQLStmt1 = N'INSERT INTO TestTable (TableName)
VALUES(' + @ResulTableName + N')'
EXEC sp_executesql @SQLStmt1