Page 1 of 1

How to download and upload files from the server?

Posted: Fri 23 Apr 2010 16:27
by brace
I would like to connect to a SQL Server located remotely (SQL Server exposed to an external IP) and upload and download documents from a fileserver that is in LAN with the remote server.

I embedded this code in a TMSStoredProcedure

SELECT BulkColumn as MyFile FROM OPENROWSET(BULK '\FILESERVER\SharedFolder\hello.txt' , SINGLE_BLOB) AS X

then from Delphi I cast this as TBlobFIeld and SaveToFile

Can you suggest a way to do the opposite? So saving a local file to the remote \FILESERVER\SharedFolder ?

Thanks.

Posted: Tue 27 Apr 2010 09:35
by Dimon
SDAC doesn't support exporting data from a table to a server file, because Transact-SQL doesn't allow do it.

Posted: Tue 27 Apr 2010 15:44
by brace
I found a way to perfome what I need using bcp, anyway this means executing xp_cmdshell so it is not something doable directly with sdac.
Thanks for the answer.