When attempting to run the SQL script provided in our Sophos Upgrade Advisor documentation the script fails to run and you see an error similar to the following:
C:\>sqlcmd -E -S .\sophos -i db.sql Msg 137, Level 15, State 1, Server SERVER-NAME\SOPHOS, Line 2 Must declare the scalar variable "@user_name". Msg 137, Level 15, State 2, Server SERVER-NAME\SOPHOS, Line 16 Must declare the scalar variable "@user_name".
First seen in Enterprise Console 5.1.0
Operating systems Windows 2000 only.
This error is only seen when upgrading a Windows 2000 Server computer installed with Enterprise Console 4.0.
The script provided is incomplete and requires an additional line to function correctly.
DECLARE @user_name NVARCHAR(128);
The full script should be:
DECLARE @user_name NVARCHAR(128); SET @user_name = (SELECT TOP(1) [name] FROM sys.database_principals WHERE [name] LIKE '%Sophos DB Admins'); DECLARE @login_name NVARCHAR(128); SET @login_name = (SELECT TOP(1) [name] FROM sys.server_principals WHERE [name] LIKE '%Sophos DB Admins'); DECLARE @sql NVARCHAR(max); SET @sql = N'ALTER USER [' + @user_name + N'] WITH LOGIN = [' + @login_name + N']'; EXEC sp_executesql @stmt = @sql;
Every comment submitted here is read (by a human) but we do not reply to specific technical questions. If you need technical support please post a question to our community. Alternatively for licensed products open a support ticket.