I have an SQL script that throws an error about an undefined variable, but the variable is obviously defined.
The error is thrown here in the second line:
DECLARE @tenantId1 uniqueidentifier = '00000000-0000-0000-0000-000000000001';
EXEC sp_set_session_context @key=N'TenantId', @value=@tenantId1;
An error occurred when executing the SQL command:
EXEC sp_set_session_context @key=N’TenantId’, @value=@tenantId1
Must declare the scalar variable “@tenantId1”. [SQL State=S0002, DB Errorcode=137]
what’s the problem there?