July 15, 2008 at 1:11 am
Hi Team,
I am finding a small problem in SSIS package. I need to send the dates dynamically to my package.
considering am having a query. select * from table where date >@value
I have created "vMyvar" as Datetime and "value" as string. with scope as package level. Now created a script task with read variable as vmychar and write variable as value. for "value" variable I have changed the evaluate as expression to true.
Clicked Design script and written the following code.
Public Sub Main()
Dim vars As Variables
Dim temp As DateTime
Dim str As String
Dts.VariableDispenser.LockOneForRead("vMyVar", vars)
vars("temp").Value = vars("vMyVar").Value
str = "select * from rl_publication where publication_date=" +
vars("temp").Value.ToString()
Dts.VariableDispenser.LockOneForWrite("value", vars)
vars("value").Value = str
vars.Unlock()
Dts.TaskResult = Dts.Results.Success
End Sub
In OLEDB source, I got the variable "Value" for sql command for variable. But clicking ok button am getting the below error.
Error at Data Flow Task 1 [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object.".
Thanks and Regards,
Venkatesan Prabu, 😛
My Blog:
http://venkattechnicalblog.blogspot.com/
July 15, 2008 at 5:09 am
I'm sorry, but I don't quite get your requirement.
If you need to do some select for each in date in an onther select, shouldn't it be easier to use a For Each container in your SSIS package?
Converting dates from datetime to string and vice versa should be easy using expressions, I don't see the requirement to use scripting...
Peter Rijs
BI Consultant, The Netherlands
April 18, 2012 at 12:17 am
Hi,
I am also facing the same above issue... could you please help me out how to solve it.
Thanks
Ranjith
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply