Author |
Topic |
pyanko
Starting Member
5 Posts |
Posted - 2009-12-18 : 15:06:59
|
What is the best way to dynamically create a text log file with the current date/time stamp as part of the file name? |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 15:26:59
|
Go through this link.Its a step-by-step solution to your question.http://www.mssqltips.com/tip.asp?tip=1443 |
|
|
pyanko
Starting Member
5 Posts |
Posted - 2009-12-18 : 15:57:04
|
Thanks, but I don't think this works for log file names. The file name needs to be defined before (or as) the package executes, not after execution has begun. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 16:08:00
|
What is the difference between quote: (or as) the package executes
and quote: after execution has begun.
The file will get created with the current date...when the package executes..isn't that what you need? |
|
|
pyanko
Starting Member
5 Posts |
Posted - 2009-12-18 : 16:23:57
|
I used the exact method described in your link. However, the file name is defined in a script "after" execution begins. The package begins writing to the log file before the script is executed. Hence, the variable used for the file name has not been populated, so the default name defined in the connection manager is use. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 16:30:08
|
Ok..in that case...while choosing a new flat file connection ..choose expressions to name it and you can dynamically name the file in the connection string..using the date parms...as explained here..http://www.mssqltips.com/tip.asp?tip=1084 |
|
|
pyanko
Starting Member
5 Posts |
Posted - 2009-12-18 : 17:34:12
|
Thanks - that last link worked. But, I'm getting two log files, 1-2 seconds apart. May be in my logging configuration. Please let me know if anything comes to mind for that. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-19 : 10:34:37
|
I'm not sure I understand the question...you are getting two log files out of a single connection manager? |
|
|
pyanko
Starting Member
5 Posts |
Posted - 2009-12-21 : 11:37:37
|
Logging is taking place at the package level, and yes, two log files are generated, with date/time stamps 1-2 seconds apart. |
|
|
ddiamond
Starting Member
4 Posts |
Posted - 2010-08-30 : 15:09:49
|
pyanko,"Logging is taking place at the package level, and yes, two log files are generated, with date/time stamps 1-2 seconds apart."I have the exact same problem. Did you ever resolve this? |
|
|
ddiamond
Starting Member
4 Posts |
Posted - 2010-08-30 : 15:21:00
|
After further experimentation, I believe this is only an issue when running your package out of visual studio. When I deploy my package to the server an run it from a sql agent job, it works fine. |
|
|
|