function to call db name

function to call db name

 

  

I inherited 2 dozen scripts for data loading which have the source db name hardcoded in them. The db name changes every month. I want to create a function to store the db name as a string and call the function in each procedure.

Is this the best way?
How do I write that function?

-K
MS Sql Server LazyDBA home page