I want to find databases in SQL server which contains specific word in it. for example DB name = DBNAME_XYZ . I know I can list all DBs using SELECT name FROM master.dbo.sysdatabases
but don't know how to fetch DBs which contain "XYZ" . Thanks in advance .
CodePudding user response:
Using below query
SELECT NAME FROM SYS.DATABASES WHERE NAME LIKE '%XYZ%'