I need to run a script to configure a LocalDB (v11.0.3000) instance and database (from a .NET 4.5 program) and I want to record results at various stages. Someone suggested xp_logevent but it doesn't seem to work for me. Should it? When that failed, I tried RAISERROR ... WITH LOG but that didn't work, either. Both write to the SQL Server log but neither write to the Windows Application event log (or any other log that I can see).
Note: although I want to run the script from a program, at this stage, I'm just using Mgmt Studio.
EXEC master..xp_logevent 50001, 'Test' EXEC master..xp_logevent 50002, 'Test', informational EXEC master..xp_logevent 50003, 'Test', warning EXEC master..xp_logevent 50004, 'Test', error
RAISERROR (N'This is message %s %d.', -- Message text. 10, -- Severity, 1, -- State, N'number', -- First argument. 5) WITH LOG;
I've tried the same code under SQL Server Express (v11.0.3128) and it worked.
The account I'm using is sysadmin. I've tried it with the account in BUILTIN\Administrators in case that was part of the problem - I know you have to be an admin to create an event source - but it didn't work.
If there's nothing that can be done to get either to work, is there another way of getting output from LocalDB on a client machine? All that will be installed is LocalDB and .NET 4.5.
I've tried this on a second machine, recently upgraded to SQL Express 2012 SP1, and already with LocalDB, and got the same results.