Hi Phil and foxxo,
thank you both for your replies. After I knew what to search for, I found a way to make 3 package variables;
FileDate = getdate() --For now, it is possible that not all clients send their data monthly... We might have to backdate some
LastMonth = (DT_Date)DATEADD("D",-(Day( @[User::FileDate])), @[User::FileDate])
LoanFileName = "Loans" + (DT_WSTR, 4) YEAR(@[User::LastMonth]) +
RIGHT("0"+(DT_WSTR, 2) MONTH(@[User::LastMonth]),2) +
RIGHT("0"+(DT_WSTR, 2) DAY(@[User::LastMonth]),2)
Now my issue is trying to reference these variables within the tasks. I tried using the OLE DB Destination and setting the data access mode to Table name or view name variable. I can select my variable from the list, however I get an error message;
Opening a rowset for "Loans20130531" failed. Check that the object exists in the database.
So, I thought I would try and use an execute SQL task to create the table before the data flow task runs. I ran into some trouble when trying to name the create table command;
CREATE TABLE @[User::LoanFileName](
[Customer ID] varchar(50),
[Account Number] varchar(50),
[Original Loan Amount] varchar(50),
[Maturity Date] varchar(50)
The above doesn't work, but I read that you can replace the @[User::LoanFileName] with a ? and then map it in the parameter mapping section of the execute SQL task editor. I tried that, but its still not working. I think I'm stuck now.... Any ideas?