Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure - returning database name

Author  Topic 

smcgrath
Starting Member

1 Post

Posted - 2002-04-22 : 12:47:52
Is there any way I can use a stored procedure to give me back the name
of the database I am currently in???

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-22 : 12:57:18
You can use the DB_NAME() function:

USE pubs
SELECT DB_NAME()
--returns pubs

Go to Top of Page
   

- Advertisement -