If you run your script with an account that is in the sysadmin role, you can use raiserror with severity 20 or above to terminate the connection.if not exists (select 1 from master.dbo.sysdatabases where name = 'Beacon') begin raiserror ( 'Database Beacon does not exist',22,1) with log end
Results:[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData (CheckforData()).Server: Msg 11, Level 16, State 1, Line 0General network error. Check your network documentation.Connection Broken
CODO ERGO SUM