Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SFTP a file created on SQL Server with a Stored Procedure to a UNIX Server

$
0
0

I'm trying to create a SQL Server Stored Procedure to generate an XML file. Once the file is generated, it has to SFTP the file to a UNIX Server. I've never done the SFTP stuff before so here I'm seeking help. Please take a look at the below Stored Procedure that I've written and help me out.

USE [myDB] GO

SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

CREATE PROC [dbo].[GenerateXML]

AS

SELECT FileID, SystemID, FileName

FROM dbo.File

FOR XML raw('File'), elements, root('File') DECLARE @cmd VARCHAR(255)

SET @cmd = 'osql -E /Q “exec GenerateXMLproc” /o usadevenv01:/home/xml/file.xml'

EXEC xp_cmdshell @cmd

GO



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>