If you don't know how to create SSIS Package then go through below link first.
Now, I'll explain how to give random name to excel file with time stamp.
Step 1:
Right click on the Destination excel connection (Excel Connection Manger) and click properties as shown in the below snapshot.
Step 2:
Click on the Expressions as shown in snapshot below.
Step 3:
Click on the ExcelFilePath in the property dropdown and set the expression
In expression we are concatenating time stamp with excel file name. As example below
"F:\\Client_"+
RIGHT("0" + (DT_STR,2,1252)DATEPART("MM" ,GETDATE()), 2) + "-"+
RIGHT("0" + (DT_STR,2,1252)DATEPART("DD" ,GETDATE()), 2) + "-"+
(DT_STR,4,1252)DATEPART("YYYY" ,GETDATE()) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) + "" + Right("0" + (DT_STR,4,1252) DatePart("n",getdate()),2) + ".xls"
Now when you run the package, every time it will generate excel file with time stamp.
This is all about the article.
Create SSIS Package
Now, I'll explain how to give random name to excel file with time stamp.
Step 1:
Right click on the Destination excel connection (Excel Connection Manger) and click properties as shown in the below snapshot.
Step 2:
Click on the Expressions as shown in snapshot below.
Step 3:
Click on the ExcelFilePath in the property dropdown and set the expression
In expression we are concatenating time stamp with excel file name. As example below
"F:\\Client_"+
RIGHT("0" + (DT_STR,2,1252)DATEPART("MM" ,GETDATE()), 2) + "-"+
RIGHT("0" + (DT_STR,2,1252)DATEPART("DD" ,GETDATE()), 2) + "-"+
(DT_STR,4,1252)DATEPART("YYYY" ,GETDATE()) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) + "" + Right("0" + (DT_STR,4,1252) DatePart("n",getdate()),2) + ".xls"
Now when you run the package, every time it will generate excel file with time stamp.
This is all about the article.
No comments:
Post a Comment