Home Forums SQL Server 2012 SQL Server 2012 - T-SQL force using a specific SQL Server/Instance in T-SQL RE: force using a specific SQL Server/Instance in T-SQL
SQLnbe
SSChasing Mays
Points: 601
More actions
August 22, 2014 at 7:53 am
#1740233
Sean Pearce (8/22/2014)Using RAISERROR with a severity level of 20 will disconnect the session immediately.IF (@@SERVERNAME='Prod')BEGINRAISERROR('Incorrect Server', 20, -1) WITH LOG;END;GO
Sean Pearce (8/22/2014)
IF (@@SERVERNAME='Prod')
BEGIN
RAISERROR('Incorrect Server', 20, -1) WITH LOG;
END;
GO
Thanks