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-10-01 : 01:06:05
|
| Charlie writes "I am working on an application that draws data from each of the SQL servers in our system. The app needs to have the ability for the users to enter in a new server name and have the query jobs start querying it on the fly. To do this I have a table that lists each server name. When the queries run, a cursor is used to fetch each server name into a variable which is then concatenated into the SQL statement.Example....EXECUTE('SELECT * FROM ' + @server_name + '.master.dbo.sysobjects WHERE type = ''u''')This works fine, but the queries quickly become a huge mess of single quotes the more times the @server_name variable needs to be used. Does anyone have any suggestions of an easier way to supply server names to queries or am I stuck with this method?" |
|
|
|
|
|