FTP_FileUpload
Uploads a file to a remote FTP Server
- Stored Procedure
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
EXEC SQLHTTP.net.FTP_FileUpload @URL, [@UserName], [@Password], @LocalFilePath, [@StatusCode], [@StatusDescription]
Name | Type | Description |
---|---|---|
@URL | nvarchar(4000) | Required. FTP address that includes the destination file name
|
@UserName | nvarchar(200) | Optional. Leave blank (NULL) for anonymous connections
|
@Password | nvarchar(200) | Optional. Leave blank (NULL) for anonymous connections
|
@LocalFilePath | nvarchar(4000) | Required. Source file path of the file to upload.
|
@StatusCode | int | Optional. Output Parameter. Numeric status of the response.
|
@StatusDescription | nvarchar(MAX) | Optional. Output Parameter. Status Description returned with the response. |
Accessing the file system will be performed in the context of the SQL Server instance process. You can set SQL Server to run using a specific network account, or a Local System Account.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
DECLARE @URL nvarchar(4000) DECLARE @LocalFilePath varchar(4000) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) SET @URL = 'ftp://speedtest.tele2.net/upload/QuarterlyReport.pdf' SET @LocalFilePath = 'C:\MyLocalFiles\QuarterlyReport.pdf' EXEC SQLHTTP.net.FTP_FileUpload @URL = @URL, @LocalFilePath = @LocalFilePath, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT SELECT @StatusCode AS StatusCode, @StatusDescription AS StatusDescription |
1 2 3 4 5 |
StatusCode StatusDescription ------------ ------------------------------------------------------------------ 150 150 Opening BINARY mode data connection for 1KB.zip (1024 bytes). |