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.
Author |
Topic |
jamie_pattison
Yak Posting Veteran
65 Posts |
Posted - 2008-08-08 : 07:31:52
|
I have a flat file with a connector. I would like to run this app and it automatically saves the file to \\Server\Share$\ with a date and time of when the file was generated. So far i have aregular expression:DT_WSTR,30)(GETDATE())Which i found on the web, but not sure how to add the filename to be produced when this package runs and how to add the UNC path to it. Could someone advise please in a step by step format as im new to SSIS?Thanks in advance |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-08 : 08:44:50
|
Hi jamie,1. right click on connection manager for your flatfile2. choose properties3. click Expressions and then that little button [...]4. in property expression editor choose ConnectionString in the Property Column5. in Expression Column click [...]6. Enter Expression like my example below7. click Button [Evaluate Expression] to see it works8. click ok9. click ok10. done"\\\\servername\\shared$\\test_" + (DT_WSTR,4)YEAR(GETDATE()) + RIGHT("0" + (DT_WSTR,2)MONTH(GETUTCDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DAY( GETUTCDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DATEPART("hh", GETUTCDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DATEPART("mi", GETUTCDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DATEPART("ss", GETUTCDATE()), 2) + ".txt" WebfredEdit: Try to modify this example for your satisfaction! |
 |
|
jamie_pattison
Yak Posting Veteran
65 Posts |
Posted - 2008-08-08 : 08:52:37
|
Hello WebFredI tried that and the expression works (thanks for that) BUT i receive the error:TITLE: Package Validation Error------------------------------Package Validation Error------------------------------ADDITIONAL INFORMATION:Error at Package [Connection manager "ffcmUATClaimCSV"]: The file name "\\servername\shared$\test_20080808125031.csv" specified in the connection was not valid.Error at Package: Connection "ffcmMyNewFile" failed validation. (Microsoft.DataTransformationServices.VsIntegration)------------------------------BUTTONS:OK------------------------------When i run the application. Whats going wrong here?Thanks |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-08 : 09:09:46
|
Yesyou have to modify this servername\shared$\test_ to fit your environment.Webfred |
 |
|
jamie_pattison
Yak Posting Veteran
65 Posts |
Posted - 2008-08-08 : 09:28:39
|
Perfect - Thank you. It all works.I dont suppose you know a site where i could learn more about expressions as i think it took hours just to get to the basics?Thanks again |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-08 : 09:49:02
|
quote: Originally posted by jamie_pattison Perfect - Thank you. It all works.I dont suppose you know a site where i could learn more about expressions as i think it took hours just to get to the basics?Thanks again
I am sorry, but I don't know any site that can be recommended to this.I am getting only snatches myself.But try and error makes me a bit smart for that.Maybe some of the experts on this sqlteam-site (i love this site) kann advice a good link.Have a nice weekend!Webfred |
 |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
|
|
|
|
|
|