Invalid value of cast specification

  • I am getting an error while executing SSIS package like Invalid value of cast specification.

    I have OLE DB Source and OLE DB Destination on the Data Flow task. There is query in the OLE DB Source which except paramenter as date. for example

    select * from tablename where date > = ?

    created variable mdate and type is datetime and assign value 5/1/2009 but when I execute a package it's returns error.

    Any help will be appreciated.

  • What's the exact error message and where does it occur?

    What is the data type of the of the column in your source query's WHERE clause?

  • here is the error , I am getting.

    [OLE DB Source [1]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E21 Description: "Invalid character value for cast specification".

    when I run this query on the Management Studio like this. It works fine.

    declare @date datetime

    set @date = '5/1/2009'

    select * from tablename where date = @date

    I created a variable in SSIS package like Date and type is datetime and assign a value 5/1/2009.

    when I run the package it gives me above mentioned error.

  • Problem is solved.

    Actually, there were two variables created on SSIS package, one is Date and other one is Client and when I mapped the date variable with parameters, it was mapping client parameters that is why I was geting cast specification error because it was passing client name in the date parameter.

    Thanks for your help.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply