Results 1 to 4 of 4

Thread: rename export file after DTS

  1. #1
    rudi Guest

    rename export file after DTS

    Hi everybody,
    I am running DTS export data evry night, where my MyTable is being transformed into MyTable.txt.
    In my MyTable which sits in sql 7.0 I have a field which shows today's date as julian date ( today julian date is 109).
    Is there a way to write a procedure/trigger which will rename MyTable.txt on daily basis into MyTable109.txt for today;
    MyTable110.txt for tomorrow; etc...
    Kind of stuck with that..
    Thanks alot,
    rudi

  2. #2
    KROM Guest

    rename export file after DTS (reply)

    note- substitute 'juliandate' with your juliandate value or variable

    declare @aa varchar(255)
    set @aa= 'master..xp_cmdshell "rename //servername/sharename/MyTable.txt MyTable'+'juliandate'+'.txt"&# 39;
    exec(@aa)


    ------------
    rudi at 4/18/00 5:50:39 PM

    Hi everybody,
    I am running DTS export data evry night, where my MyTable is being transformed into MyTable.txt.
    In my MyTable which sits in sql 7.0 I have a field which shows today's date as julian date ( today julian date is 109).
    Is there a way to write a procedure/trigger which will rename MyTable.txt on daily basis into MyTable109.txt for today;
    MyTable110.txt for tomorrow; etc...
    Kind of stuck with that..
    Thanks alot,
    rudi

  3. #3
    AB Guest

    rename export file after DTS (reply)

    The whole solution is:

    declare @aa varchar(255)
    declare @jd varchar(3)
    set @jd = datepart(dy, getdate())
    set @aa= 'master..xp_cmdshell "rename //servername/sharename/MyTable.txt MyTable'+@jd+'.txt"'
    exec(@aa)

    If the output file is on the SQL server, then, instead on the UNC pathname, it's simpler to use a local file path (like "C:exportsMytable.txt&#34.

    ------------
    KROM at 4/19/00 9:49:06 AM

    note- substitute 'juliandate' with your juliandate value or variable

    declare @aa varchar(255)
    set @aa= 'master..xp_cmdshell "rename //servername/sharename/MyTable.txt MyTable'+'juliandate'+'.txt"&# 39;
    exec(@aa)


    ------------
    rudi at 4/18/00 5:50:39 PM

    Hi everybody,
    I am running DTS export data evry night, where my MyTable is being transformed into MyTable.txt.
    In my MyTable which sits in sql 7.0 I have a field which shows today's date as julian date ( today julian date is 109).
    Is there a way to write a procedure/trigger which will rename MyTable.txt on daily basis into MyTable109.txt for today;
    MyTable110.txt for tomorrow; etc...
    Kind of stuck with that..
    Thanks alot,
    rudi

  4. #4
    rudi Guest

    rename export file after DTS (reply)

    Thanks a lot to all of you!!!
    rudi


    ------------
    AB at 4/19/00 12:00:26 PM

    The whole solution is:

    declare @aa varchar(255)
    declare @jd varchar(3)
    set @jd = datepart(dy, getdate())
    set @aa= 'master..xp_cmdshell "rename //servername/sharename/MyTable.txt MyTable'+@jd+'.txt"'
    exec(@aa)

    If the output file is on the SQL server, then, instead on the UNC pathname, it's simpler to use a local file path (like "C:exportsMytable.txt&#34.

    ------------
    KROM at 4/19/00 9:49:06 AM

    note- substitute 'juliandate' with your juliandate value or variable

    declare @aa varchar(255)
    set @aa= 'master..xp_cmdshell "rename //servername/sharename/MyTable.txt MyTable'+'juliandate'+'.txt"&# 39;
    exec(@aa)


    ------------
    rudi at 4/18/00 5:50:39 PM

    Hi everybody,
    I am running DTS export data evry night, where my MyTable is being transformed into MyTable.txt.
    In my MyTable which sits in sql 7.0 I have a field which shows today's date as julian date ( today julian date is 109).
    Is there a way to write a procedure/trigger which will rename MyTable.txt on daily basis into MyTable109.txt for today;
    MyTable110.txt for tomorrow; etc...
    Kind of stuck with that..
    Thanks alot,
    rudi

Posting Permissions

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