Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-11-01 : 09:06:11
|
| Todd Peterson writes "I'm on a project where I need to use a variable for the database object, but I've found this can't be done. If I can't, then I'll have to put my script in EACH database. Can someone show me how to do this using this simple select statement using the Northwind database?This works.....DECLARE @db_name varchar(50) SET @db_name = 'Northwind'SELECT address,cityFROM NorthWind..CustomersThis doesn't....DECLARE @db_name varchar(50) SET @db_name = 'Northwind'SELECT address,cityFROM @db_name..CustomersThank you!!" |
|
|
|
|
|