Convert works in T-SQL, not as DTS-parameter?

  • I've got this situation:

    For many SQL-statements in this system we're working on we only need year-month information, format yyyymm; example '200511'. Occasionally we have to compare this value with a real date, format yyyymmdd. What I had thought to do is add '01' to this year-month value. With a constant this works fine: '200511' + '01' gives me '20051101'.

    However, in this DTS-package the year-month value is a parameter, which is determined anew for each run. When I ask ...AND field-with-datetime > RUN_PER + '01' in the Data Transformation task, or ExecuteSQL task I receive an Unidentified Error.

    I am going to solve this by adding another Global Variable with the format yyyymmdd, but this behaviour irritates me. As said, when using constants both DTS and QA recognize the value correctly. When using a parameter I get this error.

    Is there something I do wrong? Is this behaviour intentionally? I dread to call in MS Support on this; I still have a case of horros when I think of the last time they tried to solve a problem for us...

    Greetz,
    Hans Brouwer

  • I've found what the problem is. In T-SQL the value 20051201 ias recognized as a valid date. For whatever reason, when the Data Transformation task in DTS is executed, this value is not recorgnized as a valid date.

    I can solve the problem now, but it still makes me wonder why. Probably is due to the differences of VBscript(which I guess is what a DataTransformationtask is translated to) and T-SQL.

    Greetz,
    Hans Brouwer

Viewing 2 posts - 1 through 2 (of 2 total)

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