Setting DateTime variable a value
Hi all, I have an ETL in which I am pulling a chunk of data. Now I wish to pull data starting from Start Date of Current Month - 2 months now in my ETL I manage it by using SQL Query. First I pull the data in a temporary table delete the data from the original table. & insert it from the temp to the original table. But mean while GetDate() sometimes get's changed & I tend to delete some more data. So now I wish to store the dates in a variable initially & then use the variable for subsequent operations. Please tell me how can I store Start Date of Current Month - 2 months in a variable. Thanks in advance.
March 12th, 2011 5:18am

Go to Expression Property of a varibale. here write expression for Getdate() - 2 Months. this will be----> DATEADD("Month",-2,GETDATE()). Hope this help you. Gaurav Gupta http://sqlservermsbiblog.blogspot.com/ Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
March 12th, 2011 5:39am

instead of using the getdate() function use the system variable StartTime. This remains constant throughout the package execution unlike the getdate function which shows the date at the time of use..My Blog | Ask Me
March 12th, 2011 6:09am

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

Other recent topics Other recent topics