Forum Discussion
Joshua1627
Feb 08, 2024Copper Contributor
Must declare the scalar variable "@tableName".
i'm writing a stored procedure , to get all the tablename present only in table1. and not in table2 tableName is the column name . but i'm getting the below error "Must declare the scalar variable ...
rmeldrum
Feb 13, 2024Copper Contributor
You could try splitting up the declaration:
DECLARE @tableName NVARCHAR(255)
SET @tableName = 'table1';
Also is it possible that when you ran the script you accidentally did not select the entire script? Sometimes when I am testing and only want to run part of a script I miss the variable declarations and get the same error.
DECLARE @tableName NVARCHAR(255)
SET @tableName = 'table1';
Also is it possible that when you ran the script you accidentally did not select the entire script? Sometimes when I am testing and only want to run part of a script I miss the variable declarations and get the same error.