I want to create a new table with existing table, where the table names should to pass from input parameters. I am trying the following code.
DECLARE @oldTableName nvarchar(50)
DECLARE @newStagingTableName nvarchar(50)
SET @oldTableName='OldTableName'
SET @newStagingTableName ='NewTableName';
SELECT * INTO @newStagingTableName FROM @oldTableName WHERE 1 = 0;
The SQL server is giving error while parsing this query.