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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Database Name 1

Status
Not open for further replies.

StormbringerX

Programmer
Dec 14, 2000
102
US
Hi all,

Is there a Transact SQL function that will return the database NAME that a Stored Procedure is currently running in?

My situation is this: On one server there will be several databases that contain identically defined tables. The database names are based on a fiscal year, ie, there is a database named YEAR2004, another named YEAR2005, and so on.

All databases behave and contain identically defined information, views and stored procedures, but of course the data will be unique to each database.

I need to be able to ascertain, within a currently running SP, the name of the database in which the SP is running.

Is this possible?

Thanks for your input...

Dave
 
Daaang, thanks Jamfool. Yet again, I've tried to make things more difficult than they actually are.

A star for your trouble....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top