Friday, February 24, 2012

How to find current database

Is there a way to find out what is the current database?
In Query analizer, you execute "use <db-name>", and you can se the current
database in the combo box. Is the an SQL command to find currrent database ?
Boaz Ben-Porat
Milestone SystemsSELECT DB_NAME()
"Boaz Ben-Porat" <bbp@.milestone.dk> wrote in message
news:%23UYynvt5FHA.1000@.tk2msftngp13.phx.gbl...
> Is there a way to find out what is the current database?
> In Query analizer, you execute "use <db-name>", and you can se the current
> database in the combo box. Is the an SQL command to find currrent database
> ?
> Boaz Ben-Porat
> Milestone Systems
>|||See function DN_NAME in BOL.
Example:
select db_name()
go
DB_NAME
http://msdn.microsoft.com/library/d...br />
706d.asp
AMB
"Boaz Ben-Porat" wrote:

> Is there a way to find out what is the current database?
> In Query analizer, you execute "use <db-name>", and you can se the current
> database in the combo box. Is the an SQL command to find currrent database
?
> Boaz Ben-Porat
> Milestone Systems
>
>|||Correction:
See function DB_NAME in BOL.
AMB
"Alejandro Mesa" wrote:
> See function DN_NAME in BOL.
> Example:
> select db_name()
> go
> DB_NAME
> http://msdn.microsoft.com/library/d... />
b_706d.asp
>
> AMB
> "Boaz Ben-Porat" wrote:
>

No comments:

Post a Comment