SyntaxFix
Write A Post
Hire A Developer
Questions
Actually it's best to use:
IF DB_ID('dms') IS NOT NULL --code mine :) print 'db exists'
See https://docs.microsoft.com/en-us/sql/t-sql/functions/db-id-transact-sql and note that this does not make sense with the Azure SQL Database.