Problem in log file creation
Hi,
I am creating a Log file with package name associated with date and timestamp with it. Below is the expression i am using
@[User::varLogFilePath]+ @[System::PackageName]+ "-"+SUBSTRING((DT_WSTR,30)GETDATE(),1,10)+"_"+ SUBSTRING((DT_WSTR,30) getdate(),12,2 ) + SUBSTRING((DT_WSTR,30) getdate(),15,2 ) + SUBSTRING((DT_WSTR,30) getdate(),18,2 )+ ".log"
which gives me the string D:\logs\SSIS_Logs\Test-12-2012-11-13_141958.log.
Problem is as the package executes it create several log files as the time changes (from second to second i.e. Test-12-2012-11-13_141958.log, Test-12-2012-11-13_141960.log and so on)
but i want only one log file.
I dont know why it is not working in SSIS as it worked in SQL Server 2000 DTS.
Please advice on this. Thanks in advance
Amit
November 13th, 2012 2:40pm
The easiest way to fix this issue is to use the StartTime system variable rather than getdate(). It will be constant for the currently running session.Russel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Twitter: @sqlmovers; blog: www.sqlmovers.com
Free Windows Admin Tool Kit Click here and download it now
November 13th, 2012 2:48pm
Hi Loski,
Thanks for reply, i can use system time but it will give me log file name Test-12-2012-11-13_21958 PM.log then i need to write case to change 2 to 14.
Thanks,
Amit
November 13th, 2012 3:40pm
Hi Loski,
I am getting the same result with starttime. it creating multiple files when i run from BIDS in one file it contains the header i.e. event, computer, operator etc and then in another it contains header+data.
Don't know..its a SSIS but or something else.
Thanks,
Amit
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2012 10:00am
No answer from anyone....amazing
November 14th, 2012 12:48pm
No answer from anyone....amazing
Not amazing if you realize that I have been to two SQL Saturdays and SQL PASS (with one precon seminar) the last two weeks and after two days at home (after two weeks away) I flew from Dallas to Minneapolis for three days.
Try :(DT_WSTR, 30) (DT_DBTIMESTAMP) @[System::StartTime]
The datatype for StartTime is different from what is returned from GETDATE(). This will deal with your date format issue.
About the issue with the same log file name for different values. I will have to wait on that.
Russel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Twitter: @sqlmovers; blog: www.sqlmovers.com
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2012 6:08pm
No answer from anyone....amazing
Not amazing if you realize that I have been to two SQL Saturdays and SQL PASS (with one precon seminar) the last two weeks and after two days at home (after two weeks away) I flew from Dallas to Minneapolis for three days.
Try :(DT_WSTR, 30) (DT_DBTIMESTAMP) @[System::StartTime]
The datatype for StartTime is different from what is returned from GETDATE(). This will deal with your date format issue.
About the issue with the same log file name for different values. I will have to wait on that.
Russel Loski, MCT, MCITP Business Intelligence Developer and Database Developer 2008 Twitter: @sqlmovers; blog: www.sqlmovers.com
November 14th, 2012 6:08pm