{"id":4395,"date":"2017-11-22T10:25:20","date_gmt":"2017-11-22T16:25:20","guid":{"rendered":"https:\/\/www.bhinfo.com.mx\/cursos\/?p=4395"},"modified":"2018-06-11T13:41:42","modified_gmt":"2018-06-11T18:41:42","slug":"sql-link-server","status":"publish","type":"post","link":"https:\/\/www.bhinfo.com.mx\/cursos\/2017\/11\/22\/sql-link-server\/","title":{"rendered":"SQL, Link server"},"content":{"rendered":"<p><strong>Verificar el nombre del server<\/strong><\/p>\n<pre class=\"lang:tsql decode:true\">--\r\nselect * from sysservers\r\n--\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Cambiar el nombre del servidor<\/strong><\/p>\n<pre class=\"lang:tsql decode:true\">--\r\nsp_dropserver 'OLD_SERVER', 'droplogins'\r\ngo\r\nsp_addserver 'NEW_SERVER', 'local'\r\ngo\r\n--\r\n<\/pre>\n<p>Nota: reiniciar instancia para que tome el valor nuevo.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>PARA LINKEAR A TRAVES DE ODBC Y NO POR PROVIDER<\/strong><\/p>\n<pre class=\"lang:tsql decode:true \">--\r\nUSE master\r\nGO\r\n-- Drop Existing LinkedServer [NorthWind2000]:\r\nEXEC sp_dropserver @server=N'cartera', @droplogins='droplogins'\r\nGO\r\n-- Re-create LinkedServer [NorthWind2000] by using the ODBC connection:\r\nEXEC sp_addlinkedserver @server = N'cartera',\r\n@srvproduct=N'',\r\n@provider=N'MSDASQL',\r\n@provstr=N'DRIVER={SQL Server};SERVER=cartera;Trusted_Connection=yes;'\r\n\r\nEXEC sp_addlinkedsrvlogin @rmtsrvname=N'cartera',\r\n@useself=N'True',\r\n@locallogin=NULL,\r\n@rmtuser='usrlinkserver',\r\n@rmtpassword='fccache'\r\nGO\r\nSET XACT_ABORT ON\r\n\r\n--https:\/\/cfd.sicofi.com.mx\/Sicofi\/Main\r\n--<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Link por IP<\/strong><\/p>\n<pre class=\"lang:tsql decode:true\">--\r\nUSE master\r\nGO\r\n\r\ndeclare @direccionIP varchar(20)\r\nset @direccionIP = '172.16.1.X'\r\nprint @direccionIP\r\n\r\n--sp_dropserver @direccionIP, 'droplogins'\r\nexec sp_addlinkedserver @direccionIP, 'sql server'\r\nexec sp_addlinkedsrvlogin @direccionIP, FALSE, null, 'usrlinkserver', 'fccache'\r\n\/* esto es para que funcionen los triger y los sp de otro servidor *\/\r\nSET XACT_ABORT ON\r\n--\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:plsql decode:true\">---Por Nombre\r\n\r\nUSE master\r\nGO\r\ndeclare @servidor as varchar(30)= 'srvlealtad'\r\nexec sp_dropserver @servidor, 'droplogins'\r\nexec sp_addlinkedserver @servidor, 'sql server'\r\nexec sp_addlinkedsrvlogin @servidor, FALSE, null, 'usrlinkserver', 'fccache'\r\n\/* esto es para que funcionen los triger y los sp de otro servidor *\/\r\nSET XACT_ABORT ON\r\n\r\n---<\/pre>\n\n","protected":false},"excerpt":{"rendered":"<p>Verificar el nombre del server &#8212; select * from sysservers &#8212; &nbsp; Cambiar el nombre del servidor &#8212; sp_dropserver &#8216;OLD_SERVER&#8217;, &#8216;droplogins&#8217; go sp_addserver &#8216;NEW_SERVER&#8217;, &#8216;local&#8217; go &#8212; Nota: reiniciar instancia para que tome el valor nuevo. &nbsp; PARA LINKEAR A TRAVES DE ODBC Y NO POR PROVIDER &#8212; USE master GO &#8212; Drop Existing LinkedServer [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[70,193],"tags":[353,53],"class_list":["post-4395","post","type-post","status-publish","format-standard","hentry","category-ddavila","category-sql","tag-link","tag-sql"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/posts\/4395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/comments?post=4395"}],"version-history":[{"count":8,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/posts\/4395\/revisions"}],"predecessor-version":[{"id":4397,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/posts\/4395\/revisions\/4397"}],"wp:attachment":[{"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/media?parent=4395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/categories?post=4395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bhinfo.com.mx\/cursos\/wp-json\/wp\/v2\/tags?post=4395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}