StormbringerX
Programmer
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
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