April 1, 2009 at 4:47 am
hi Friends,,
I got stuck up a bit,,,
I am passing my DB name dynamically to the variable.... and
then concanate that variavble to USE @string like this but ..
now if i want to pass the differnet server name also then how can we handle it???
i means is there any way we can pass the server name also
so like we selecting db using "USE" we can even select the server name also...
Any help would be appreciated...
Thanks in Advance
Regards,
Mithun Gite
April 1, 2009 at 5:06 am
duplicate post.
no need to cross post to multiple forums it fractures the answers you get and makes posters duplicate others work.
the "Recent Posts" link shows us everything.
continue the thread here:
http://www.sqlservercentral.com/Forums/Topic687756-149-1.aspx
Lowell
April 1, 2009 at 7:28 am
In order to "Use" a server, a connection has to already be established...SSMS does not have any commands that you can use in TSQL to change or modify your connection...so you cannot save a script that has that info. Oracle can do that with a CONNECT command I think, but there is no equivalent in SQL
the typical thing you might do, is have linked servers to other SQL servers. That link maintains the connection info, but you'll have to modify your scripts accordingly, because you have to name all your objects with the 4 part naming convention:
SELECT * FROM OtherServer.DbName.SchemaName.TableName;
a real example for me is Web1.Geo.dbo.Counties for example.
[font="Comic Sans MS"]+++BLADE+++[/font]:cool:
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply