while creating logging file how to get file name with current date and time
hi here my requirement is while creating log file it has to create with date and time in am or pm (my system time is in 12 hours format) can one tell me how to write expression for this plese
February 9th, 2011 11:27pm

To do this, you want to make the connection manager you created for the log file to be dynamic using expressions. Select the connection manager for the log file and create a new expression in the Properties window. Select the Connection String property, then click the ellipse button to enter the Expression Builder window. In the Expression box, type the following expression to fulfill your requirements. "C:\\SSIS\\" + @[System::PackageName] + "_" + (DT_STR,4,1252)DATEPART( "yyyy" , @[System::StartTime] ) + "_" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , @[System::StartTime] ), 2) + "_" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , @[System::StartTime] ), 2) + "_" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "hh" , @[System::StartTime] ), 2) + RIGHT("0" + (DT_STR,4,1252)DATEPART( "mi" , @[System::StartTime] ), 2) + RIGHT("0" + (DT_STR,4,1252)DATEPART( "ss" , @[System::StartTime] ), 2) + ".log" This code will name the file based on the package name, and then append a timestamp at the end separated by underscores. The double backslashes are required in the path, since a single backslash is an escape character. The RIGHT function enables you to easily guarantee that you will always have two characters for the month and day, for example. Otherwise, months like January would be trimmed to only a single digit (1) instead of two digits (01). When you run the package again, you’ll now see that the log file is timestamped. Sea Cloud
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 12:28am

I WANT AM OR PM IN IN TIME AND AFTER RUNNING THE PACKAGE TWO LOG FILES ARE CREATING I WANT ONLY ONE WHAT CAN I DO TO GET AND ALSO I DONT WANT SYSTEM START TIME I WANT CREATING LOG FILE TIME AND DATE
February 10th, 2011 12:36am

Create a variable which collects the result of this query [eg:@date] SELECT CONVERT(VARCHAR(20), GETDATE(), 100) [eg: Jan 1 2005 1:29PM] "C:\\SSIS\\" + @[System::PackageName] + "_" + (DT_STR,4,1252)@date+ ".log" This will work...! Please mark posts as answered where appropriate
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 1:27am

not working
February 10th, 2011 1:43am

Is it throwing any error or what is the output you are getting from that
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 1:46am

a truncation occured during evalution of expression
February 10th, 2011 1:48am

Check whether the variable is getting the correct result..... "C:\\SSIS\\" + @[System::PackageName] + "_" +@date+".log" Try this....
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 1:57am

but the file name is as Package_SELECT CONVERT(VARCHAR(20), GETDATE(), 100).log
February 10th, 2011 2:03am

There lies the problem..... Use Execute Sql task .. select a sqlserver connection ...... then in the Sql expression give this query.... then You will get the desired result..... Try This....!
Free Windows Admin Tool Kit Click here and download it now
February 10th, 2011 2:07am

i am not getting wre the problem
February 10th, 2011 2:13am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics