Move Rename File Statement

This article document the result structure required to use the Import/Export system to Move or Rename a file.

Moving / Renaming a file requires two columns:

  1. Source File Path And Name
    The Directory and File Path of the source file.
     

  2. Destination File Path And Name
    The Directory and File Path of where the file is to be moved / renamed to.

Sample SELECT Command and output:



Sample Stored Procedure to Move Released EDI Orders File to Archive

CREATE PROCEDURE spEDIGetReleasedOrdersArchive

AS

SELECT 'C:\Docs\Orders.xml' AS 'SourceFilePathAndName', 

'C:\Docs\Archive\Orders ' + REPLACE(CONVERT(VARCHAR(19), GETDATE(), 120),':','-') + '.xml' AS 'DestinationFilePathAndName'; 

GO
 

Mapping Tables

The ImportExportMap table should have the following rows created for the parameters:

Column

Value

Column

Value

[idImportExportMap]

(Auto-Assign)

[fkImportExportStep]

idImportExportStep from ImportExportStep

[SourceField]

Name of field from Source Command

[DestinationField]

sourceFilePathAndName

[fkImportExportDestinationType]

2 (for String)

[InternalMethodArgumentOrder]

1

Column

Value

Column

Value

[idImportExportMap]

(Auto-Assign)

[fkImportExportStep]

idImportExportStep from ImportExportStep

[SourceField]

Name of field from Source Command

[DestinationField]

destinationFilePathAndName

[fkImportExportDestinationType]

2 (for String)

[InternalMethodArgumentOrder]

2