I removed create DB rights from users, but i want to recieve alerts, when somebody trying to create DB on server. What error number i could use for this?
I already tried to set severity to 14(insufficient permission), but in this case i only have message
Login failed for user <>. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] This seems to be a garbage message, becouse sometimes i can see this messages in sql log even for my login.
This type of serverity level is treated as the generally error and is not normally possible to get them logged. In your scenario, you may have a try to implement
xp_LogEvent to log a user-defined message into SQL Server log file and Windows Event Viewer. For more information about this topic, please refer to this article: