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 - 2005-07-07 : 06:27:06
|
| Benoit writes "Is it possible to access a remote server and database passed in parameters to my stored proc without always concat strings in an EXEC like I actually do:EXEC(SELECT * FROM ' + @Server + '.' + @Database + '.dbo.TableName')I've just found I can link the server with an alias an always use this one in my code, but even if the default database is set, I always have to specify it in my queries.Thanks for help" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-07-07 : 06:30:03
|
| While it can be done, it is not recommended:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=52072If you are going to use stored procedures, you should use dyanmic SQL as little as possible, or (even better) not at all. Your sprocs should be specifically written to do one thing and one thing only, not as general-purpose procedures that can do anything and everything. |
 |
|
|
|
|
|