Solved

Gather list of databases

Posted on 2014-02-18
2
203 Views
Last Modified: 2014-02-18
Is there a way to obtain a list of database names programmatically that follow a certain naming convention?


For example, I want to obtain all databases that are named GHH_QA_CDR_<whatever>

db names
0
Comment
Question by:knowlton
2 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39868035
Give this T-SQL a whirl..
SELECT name 
FROM sys.databases
WHERE LEFT(name, 11) = 'GHH_QA_CDR_'   
ORDER BY name

Open in new window

0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 39868171
Yep!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article will help you understand what HashTables are and how to use them in PowerShell.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now