
October 8th, 2004, 03:37 AM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
dynamic/variable database name
Hi guys
I have a trigger which retrieves database names from a table.
I need to use this retrieved database name in another sql insert statement as a variable
e.g. set @mydbname = Select .... from.. (to get the database name)
then..
insert into @mydbname.dbo.emplTable
At the moment it reads @mydbname as the string "@mydbname" not the value the variable holds
I need the database name as a variable because i have to write to the correct database (there are 15)
Any help appreciated
Rowan 
|