I wanna check the linked server is exist then do nothing and if not then
create linked server. Any command ?
like
if not exists()
begin
EXEC sp_addlinkedserver 'FASAT\FASATBASE'
EXEC sp_addlinkedsrvlogin 'FASAT\FASATBASE', 'false', NULL, 'sa',
'testing'
end
Thanks
David
David,
You can try something like:
if not exists
(select * from sysservers where srvname like
'YourLinkedServerName')
-Sue
On Wed, 26 Jan 2005 11:51:32 -0500, "David"
<david@.north.com> wrote:
>I wanna check the linked server is exist then do nothing and if not then
>create linked server. Any command ?
>like
>if not exists()
>begin
> EXEC sp_addlinkedserver 'FASAT\FASATBASE'
> EXEC sp_addlinkedsrvlogin 'FASAT\FASATBASE', 'false', NULL, 'sa',
>'testing'
>end
>
>Thanks
>David
>
|||IF NOT EXISTS (SELECT * FROM master..sysservers WHERE..)
Keith
"David" <david@.north.com> wrote in message
news:Om6ZLd8AFHA.2792@.TK2MSFTNGP15.phx.gbl...
> I wanna check the linked server is exist then do nothing and if not then
> create linked server. Any command ?
> like
> if not exists()
> begin
> EXEC sp_addlinkedserver 'FASAT\FASATBASE'
> EXEC sp_addlinkedsrvlogin 'FASAT\FASATBASE', 'false', NULL, 'sa',
> 'testing'
> end
>
> Thanks
> David
>
|||Thanks sue
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:bvkfv0putlakl00d3qsh4sf91msjhcntg4@.4ax.com...
> David,
> You can try something like:
> if not exists
> (select * from sysservers where srvname like
> 'YourLinkedServerName')
> -Sue
> On Wed, 26 Jan 2005 11:51:32 -0500, "David"
> <david@.north.com> wrote:
>
|||Howdy Yall,
ALA, like this:
<@.sServerName, @.sSrvProduct, @.sProviderString, @.sPathToMdb are passed-in>
--Kill the server IF it exists and get rid of the user logins too!
IF EXISTS(SELECT * FROM master..sysservers where srvname=@.sServerName)
EXEC sp_dropserver @.server = @.sServerName, @.droplogins = 'droplogins'
--This will create the LINK
EXEC sp_addlinkedserver @.server = @.sServerName,
@.srvproduct = @.sSrvProduct,
@.provider = @.sProviderString,
@.datasrc = @.sPathToMdb
IF @.@.ERROR=0
EXEC sp_addlinkedsrvlogin @.sServerName, 'false', NULL, NULL, NULL
Regards,
jetgeek
"Keith Kratochvil" wrote:
> IF NOT EXISTS (SELECT * FROM master..sysservers WHERE..)
>
> --
> Keith
>
> "David" <david@.north.com> wrote in message
> news:Om6ZLd8AFHA.2792@.TK2MSFTNGP15.phx.gbl...
>
No comments:
Post a Comment