Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Inline Macro

Status
Not open for further replies.

sammye

Programmer
Oct 5, 2007
35
US
Is there such a thing as an inline macro within sql? I am not sure I am using the right terminology, but below is what I am looking for:

MACRO myRemoteTableMacro "OPENDATASOURCE('SQLNCLI','Data Source=myRemoteSvr;Integrated Security=SSPI').myDb.dbo"

select * from myRemoteTableMacro.table1

The problem is that I have a bunch of queries I am running to import data from a remote sql server into my own db and I would like not to have to repeat the connection string repeatedly for clarity's sake.

Does this exist? If there's a better way of going about this, I'm more than willing to change routes. Thanks.
 
Suggest you read about linked servers in Books online

"NOTHING is more important in a database than integrity." ESquared
 
It sounds like a good idea, but I gave it a try and could not get it to work. I am uncertain if the problem is due to how I am configuring the linked server within Management Studio Express or the fact that they are currently running SP1 and may not have a fix installed that is related - though I am not sure it applies in my case:


I use windows authentication to connect directly to the server so within the Security section of the linked server setup I checked "be made using the login's current security contect". Does this sound right? The connection properties shows "windows authentication" and my nt login which seems ok.

Unfortunately I do not have any say as to the remote server's config, so it is a little difficult to troubleshoot their side. Any ideas?

Otherwise, isn't there some type of an inline macro feature within sql? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top