I've stored procedure for exporting and populating data from databases located on outlets/branch offices to database located on head office.
for example :
i've 5 outlets databases just name it outlet1, outlet2,...,outlet5 and 1 database as data warehouse,name it central.All databases above are located in one machine on head office.
Data collected from each outlets and restored into db server machine on head office with corresponding name.
so, i'm writing a stored procedure with several parameters, one of them is @dbname varchar(20) that represents outlet database name like outlet1, outlet2, and so on.
how can i use this parameter in sql statement form like this :
--OR Using with cursor
DECLARE MyCur INSENSITIVE CURSOR FOR
i've been tried to looking for the function that acts like some_function_to_convert_varchar_into_dbobject function on sql server help.There is only 2 functions i've been founded that is DB_ID and DB_NAME that acts like that,but did'nt return value as db object except varchar and int.
i have planning to place this stored procedure on central database.
thanks for any help.
my english is not good enough, so please forgive me if any faults.