title: How to add and delete linkedserver in SQL Server in runtime using Vb.net
body: <p>I use update and insert query using joint tables in two different SQL Servers using linked server. But I don't like my remote server link open to users in SQL Server Management Studio. Instead I would like to create an delete the linked server at runtime. Is this possible using VB.net? </p>
  
  <pre><code>UPDATE Category 
  SET Category.HQID = B.[ID], 
      Category.DepartmentID = B.[departmentid], 
      Category.Name = B.[name], 
      Category.Code = B.[code], 
      Category.LastUpdated = B.[lastupdated]
  FROM 
      Category A
  INNER JOIN 
      [Myremoteserver].[MyRemoteDatabase].[dbo].[Category] B ON A.HQID = B.ID
  WHERE 
      A.HQID &lt;&gt; B.ID 
      OR A.DepartmentID &lt;&gt; B.departmentID 
      OR A.Name &lt;&gt; B.name 
      OR A.Code &lt;&gt; B.code 
      OR A.LastUpdated &lt;&gt; B.lastupdated
  </code></pre>
  
  <p>Thanks in advance</p>