August 20, 2009 at 4:37 pm
Hi Guys,
Can any one point me in the right direction please.
I have a long statement that involves trasnsferring some data to a remote database.
I have lots of statements:
insert into table1 select *.table1 from server.database.dbo.table1 where etc etc
What I want to do is create a variable or alias for the "server.database.dbo." element so that I can define this at the start of the statement and use it for different source data.
Is this possible, and if so how to do it ?
Many thanks,
Matt
August 20, 2009 at 8:46 pm
in 2005, you can use a synonym for any object...a table/view/procedure, etc, but not part of a name.
in 2000, i think you'd have to use a view for any object on your linked server, and that should work for your updates/inserts etc.
but again, it'd be a view per object, and not just the first three parts of the 4 part name;
maye someone else has a better idea.
Lowell
August 21, 2009 at 5:15 pm
I'd second Lowell's advice here. Don't really know of a better way.
August 21, 2009 at 6:41 pm
that's how I do it all the time. I even have some procedures to automate it.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply