Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server : Select current DB name

Status
Not open for further replies.

nacrotek

Programmer
Jul 20, 2005
5
US
Is there a hidden @@ variable, sp_ proc, or other feature which you can query to get the name of the current DB?

I'm looking for something like:

declare @currentDBName varchar(100)
select @currentDBName = <get current DB name>

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top