Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:41:42+00:00 2026-06-11T11:41:42+00:00

Below is my code to push a file with SQL to another server. EXEC

  • 0

Below is my code to push a file with SQL to another server.

 EXEC [ftpPushRegisteredSSIS] '12345', '54321', 'C:\TCC\Manufacturer Integration\100_110 – DiaryBelle','Daily_Dairybelle.txt', '111.111.111.11', 1, 1

 CREATE PROCEDURE [dbo].[FtpPushRegisterSSIS]
    @User VARCHAR(50),
    @Password VARCHAR(50),
    @sourceDir VARCHAR(250),
    @SourceFiles VARCHAR(50),
    @DestinationFTPServer VARCHAR(50),
    @DestinationFTPPath VARCHAR(250),
    @Overwrite BIT,
    @isASCII BIT

AS
BEGIN
    DECLARE @overwriteTF VARCHAR(5)
    DECLARE @isASCIITF VARCHAR(5)

    SET @overwriteTF = 'true'
    SET @isASCIITF = 'true'

    IF @Overwrite = 0
    BEGIN
        SET @overwriteTF = 'false'
    END

    IF @isASCII = 0
    BEGIN
        SET @isASCIITF = 'false'
    END

--  DECLARE @FtpPackage VARCHAR(150)
--  SET @FtpPackage = 'E:\ftpProcTesting\ftpPush.dtsx'
    DECLARE @cmd VARCHAR(1000)
    DECLARE @params VARCHAR(MAX)
    SET @params =   ' /set \package.variables[ftpUser].Value;"' +           @User + '"'+
                    ' /set \package.variables[ftpServer].Value;"' +         @DestinationFTPServer + '"'+
                    ' /set \package.Variables[sourceDir].Value;"' +         @sourceDir + '"' +
                    ' /set \package.variables[sourceFiles].Value;"' +       @SourceFiles + '"'+
                    ' /set \package.variables[destiPath].Value;"/' +        @DestinationFTPPath + '"' +
                    ' /set \package.variables[ftpPass].Value;"' +           @Password + '"' +
                    ' /set \package.variables[overwrite].Value;"' +         @overwriteTF + '"' +
                    ' /set \package.variables[isASCII].Value;"' +           @isASCIITF + '"'


    -- FOR Filesystem package SET @cmd = 'dtexec /f "'+@FtpPackage+'" /Rep N' --set N to V for verbose logging
    SET @cmd = 'dtexec /sq ' + 'ftpPush' + ' /ser DBNAME '
    SET @cmd = @cmd + @params

    CREATE TABLE #output ([output] VARCHAR(500))
    INSERT INTO #output
    EXEC master.dbo.xp_cmdshell @cmd -- ,NO_OUTPUT

    IF  (
            SELECT COUNT(*)
            FROM #output
            WHERE [output] LIKE '%fail%'
            OR [output] LIKE '%error%'
            OR [output] LIKE '%not valid%'
        ) > 0
    BEGIN
        SELECT * FROM #output
        RAISERROR('***|||FTP Operation FAILED|||***',15,1)
    END

    SELECT * FROM #output

END

GO

When the file Dairybelle.txt get to the server I want it to contain the getDate() in front of the filename.

Something like this: 2012-08-01_Dairybelle.txt

What changes can me made to my code to do this?

I dont want to change the file name in the current location, I just want to change it when I send it.
So the name will still always be Dairybelle.txt on my server but when it gets to them it will have the renamed file.

I know I can write code that will change the file name in place and then after it is send change it back, but I am sure there is an easier way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:41:43+00:00Added an answer on June 11, 2026 at 11:41 am

    I ended up using SSIS, it was MUCH easier!

    See the link here!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using File::Find in the code below to find the files from /home/user/data
I've got the following code below which parses a text file and indexes the
I am new to GIT and face scenario as follow: push file below: index.php
I have some code below. This code is a basic push/pop stack class that
Below code not work, but it's work fine for jsf1.2. Now the framework is
Below code saying error incorreect syntax near Main INSERT INTO tbl ( 'Week', Main,
below code is my databasehandler class i got it from a tutorial. Beside that
Below code : URL oracle = new URL(http://www.oracle.com/); URLConnection inputStream =oracle.openConnection(); InputStream in =
Below code makes form to be submitted without html5 validation... $j(document).on(click, #client_entry_add, function(event){ ajax_submit();});
In below code when I click 'Vote' a vote results screen is displayed but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.