Dynamically set DTSDestination column name from variable

  • I need to be able to set the DTSDestination column dynamically using a variable for the column name.  Here is the code I am using:

       strColName = cstr(DTSSource("ColName"))

       DTSDestination(strColName ) = DTSSource("QVal")

    I am getting the error "Invalid procedure call or argument: 'DTSDestination'".  I'm sure that I am just missing something.

    Thanks!

  • Most likely the value in ColName does not reference a valid column name in the destination table. There may be one bad row out of thousands, but it only takes one. Depending on data layout it could be a trailing space issue where "MyCol      " doesn't match "MyCol". Perhaps a NULL value. If you can't do a quick scan and find a column name that looks incorrect, try temporarily creating a permanant table with only a single column for ColName (as a varchar) and import only that column into it. You can then run a query on the imported test rows where ColName is NOT IN a list of valid column names. I hope this helps.

  • Yes, this was it.  I found it after stepping through in debug.  I had a field name misspelled in my lookup table so it could not be found.

    Thank you for responding.

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

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