How to download and upload files from the server?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

How to download and upload files from the server?

Post by brace » Fri 23 Apr 2010 16:27

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.

Dimon
Devart Team
Posts: 2888
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 27 Apr 2010 09:35

SDAC doesn't support exporting data from a table to a server file, because Transact-SQL doesn't allow do it.

brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Post by brace » Tue 27 Apr 2010 15:44

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.

Post Reply