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 - 2007-02-06 : 09:00:03
|
| Punit writes "HiI have a very simple query likeSelect *from table1inner join table2Now My problem is that table2 is from a different database. I want to make it a variable(global variabl or keep it in some table) in my application so that I dont have to change its fully qualified name if my datbse name changes. In our application Table2 is used at many sps and database name changes frequently. So it requires us to change the database name prefixed to table name at many places. Basically i want to get rid of it and make the change at one place." |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-02-06 : 10:01:47
|
| exec ('Select *from table1inner join ' + @databasename + '..table2')if the user has permission o the database/table.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|