if db_name() <> 'pubs' : db_name « System Functions « SQL Server / T-SQL Tutorial






if db_name() <> 'pubs'
   raiserror('Error in InstPubs.SQL, ''USE pubs'' failed!.',22,127) with log

GO








25.8.db_name
25.8.1.Check current database name by using DB_NAME()
25.8.2.if db_name() <> 'pubs'