Results 1 to 4 of 4

Thread: Rename a file

  1. #1
    Join Date
    Sep 2005
    Location
    Brooklyn, ny
    Posts
    69

    Unanswered: Rename a file

    Hello,

    I have a DTS process to import data from txt file to the sql.
    The File name I import is LLEEOD.txt

    and the directory is from a d:\ftp\newdata\

    When my import process completes, I have to rename that file to the current date, lets say 01-11-2006.txt

    I was trying to create another DTC (txt to txt) , but I have to provide a name myself. which is a problem, since this is a weekly process.

    Is there are other ways to rename the txt file>


    Thank you very much.

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    I have not enough experience doing these kind of things.. but that should be possible using an activex script in DTS.
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Sep 2005
    Location
    Brooklyn, ny
    Posts
    69
    thank you, but I do not have exp. in activex.

  4. #4
    Join Date
    Sep 2005
    Location
    Brooklyn, ny
    Posts
    69
    I found a half way to my solution,
    CAN ANYONE HELP ME OUT WITH REST OF IT?

    CREATE PROCEDURE [dbo].[Table_Rename] AS

    Declare @NewName varchar(100)

    Set @NewName = cast(datepart(mm,getdate())as varchar(2))
    + '-' +cast(datepart(dd,getdate())as varchar(2))
    + '-' +cast(datepart(yyyy,getdate())as varchar(4)) +'ord'

    Select @NewName
    print @NewName

    EXEC sp_rename 'Test_1', @NewName
    GO



    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •