title: How to upload files and store them in a server local path when MS SQL SERVER allows remote connections?
body: <p>I am developing a win32 windows application with Delphi and MS SQL Server. it works fine in LAN but I am trying to add the support for SQL Server remote connections (= working with a DB that can be accessed with an external IP, as described in this article: <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277" rel="nofollow noreferrer">http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277</a>).</p>
  
  <p>Basically I have a Table in DB where I keep the DocumentID, the document description and the Document path (like <code>\\FILESERVER\MyApplicationDocuments\45.zip</code>).</p>
  
  <p>Of course <code>\\FILESERVER</code> is a local (LAN) path for the server but not for the client (as I am now trying to add the support for remote connections).</p>
  
  <p>So I need a way to access <code>\\FILESERVER</code> even if of course I cannot see it in LAN.</p>
  
  <p>I found the following T-SQL code snippet that is perfect for the "download trick":</p>
  
  <p>SELECT BulkColumn as MyFile FROM OPENROWSET(BULK '\FILESERVER\MyApplicationDocuments\45.zip' , SINGLE_BLOB) AS X</p>
  
  <p>With the code above I can download a file on the client.</p>
  
  <p>But how to upload it? I need an "Uppload trick" to be able to insert new files, but also to delete or replace existing files.</p>
  
  <p>Can anyone suggest? If a trick is not available could you suggest an alternative? Like an extended stored procedure or calling some .net assembly from the server.</p>