Wednesday, March 21, 2012

Query for database name

Is there a way i can query for the database name?
thanks!select db_name()
this will give you your current database name
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"HP" <HP@.discussions.microsoft.com> wrote in message
news:F88EFB55-DEE9-448F-80A8-C5622F5BAE5B@.microsoft.com...
> Is there a way i can query for the database name?
> thanks!
>|||select * from master..sysdatabases
where [name] ='pubs'
http://sqlservercode.blogspot.com/|||Disregard my reply I thought you were looking to find out if a DB
existed and how to query for it|||select db_name()
"HP" wrote:

> Is there a way i can query for the database name?
> thanks!|||"HP" <HP@.discussions.microsoft.com> wrote in message
news:F88EFB55-DEE9-448F-80A8-C5622F5BAE5B@.microsoft.com...
> Is there a way i can query for the database name?
> thanks!
select db_name()|||Thanks!
"Absar Ahmad" wrote:
> select db_name()
> "HP" wrote:
>

No comments:

Post a Comment