to rename a file by attaching datestamp at the end of filename using SSIS File task

  • OK, OK, I figured it out...

    I am an ID10T!

    I created the variable but never gave it a VALUE!!!!

    Thanks both of you for your help, I appreciate your quick responses.

    Greg

  • Sometimes the most simple things are the most difficult. 😉

  • U might have missed to give value to that variable.

    Just check .

  • hey greg and adamm i have a ques its simple though ....

    what is the use of "0 " in that when i tried to execute

    right ("0"+ (dt_str,4,1252)right--------

    it says invalid column 0...actually y do we use 0 over there nad what is the need of using dt_str ,4,1252 i tried without using that for a select statement it wrks

    select right(datepart("yyyy",getdate()),4)

    2008 is the o/p

    whats the use of that n y we should use zero n y is it saying invalid column 0...plz let me know thkz in adavance...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • If you look at Adam's example, he's using a RIGHT function in conjuction w/ the leading zero to format the date.

    @[User::SharePath] +RIGHT("0" + (DT_STR,4,1252) DatePart("yyyy",getdate()),4)+Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".txt"

    i.e.

    20080301 vs. 200831

  • If you look at Adam's example, he's using a RIGHT function in conjuction w/ the leading zero to format the date.

    Yep. I think it makes the naming convention more consistent and legible.

  • then why do i get an error as invalid column 0 plz let me know n uhavent said me abt dt_str y do we use that with that i get the o/p so y should i use that...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • brkn eng dif 2 ustd abv b wrs plz stp ko? 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • hey jeff what i have asked is when i use the "0" in my statement i get an error as invalid column so how can i use that and why should i use the dt_str will you please let me know....i could not understand regarding that ...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Where are you trying to use this? Adam's example was used in an expression editor.

  • thkz got it i used in ssms may be that was the problem ...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • 😀 this wouldn't work in T-SQL.

    in T-SQL - something like -

    declare @FormatDateTable table (SomeDateValue datetime)

    insert into @FormatDateTable (SomeDateValue) values (getdate())

    select right('0' + ltrim(convert(varchar(2),datepart(month,SomeDateValue))),2) + '/' +

    right('0' + ltrim(convert(varchar(2),datepart(day,SomeDateValue))),2) + '/' +

    convert(char(4),datepart(year,SomeDateValue))

    from @FormatDateTable

  • Yes, it does. 😀

  • Perhaps I'm misunderstanding you Adam 🙂 Your not suggesting this expression (SSIS) is valid in T-SQL?

    i.e.

    @[User::SharePath] +RIGHT("0" + (DT_STR,4,1252) DatePart("yyyy",getdate()),4)+Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".txt"

    😀

  • Perhaps I'm misunderstanding you Adam Your not suggesting this expression (SSIS) is valid in T-SQL?

    Absolutely not!! :w00t:

    I was commenting on your post. I should have put a quote, but I got lazy 😛

Viewing 15 posts - 16 through 30 (of 47 total)

You must be logged in to reply to this topic. Login to reply