Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 how to get time value in destination file name

Author  Topic 

dhani
Posting Yak Master

132 Posts

Posted - 2008-10-16 : 19:55:05
hello all,

i am creating a file (flat file destination) from sql server table (OLEDB source) i want to name the file as "Ok Output"16102008184500.csv

till the date part it is fine (with below string),

@[User::ArchivePath]+ "Ok Output" + (DT_STR, 4, 1252) Day( @[System::StartTime] )+(DT_STR, 2, 1252) Month( @[System::StartTime] )+ (DT_STR, 4, 1252) Year( @[System::StartTime] )+ ".csv"

can any one please let me know how to get the time value (any functions )

Thanks in advance
asin

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-16 : 21:11:48
like this:

Right("0" + (DT_STR,4,1252) DatePart("hour",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("minute",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("second",getdate()),2) + ".csv"


Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-16 : 21:17:34
You can use like this:

@[User::ArchivePath]+ "Ok Output" +
(DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) +
"-" +
Right("0" + (DT_STR,4,1252) DatePart("hour",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("minute",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("second",getdate()),2) + ".csv"
Go to Top of Page

dhani
Posting Yak Master

132 Posts

Posted - 2008-10-16 : 22:35:36
thank you Sodeep,

i will check it and let you know

really i am grateful to you

Best Regards
asini
Go to Top of Page

dhani
Posting Yak Master

132 Posts

Posted - 2008-10-17 : 08:44:33
Hello Sodeep,

it is working as desired

thankyou very much

Regards
asini
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-17 : 08:51:35
Welcome Buddy!!
Go to Top of Page
   

- Advertisement -