Derived Column Expression

  • My data source is an Access database and one of the columns that is being imported contain data like "Z:\Gis\SCAN DRAWINGS\12345.tif" or "#Z:\Gis\SCAN DRAWINGS\12345.tif#". When trying to create a derived column to clean up the data and change it to http://blah/Maps/12345.tif, I get an error stating.....

    Error at Data Flow Task [Derived Column [215]]: Attempt to parse the expression "(LTRIM([drawing e-location])== "Z:\Gis\SCAN DRAWINGS\"" failed. The token """ at line number "1", character number "32" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.

    ????

    Any help would be appreciated.

  • Hello,

    I wonder if this is being caused by escape character translation i.e. needing two slashes to represent one. Just a thought …

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • Tried that and i am still getting the error message....

    Error at Data Flow Task [Derived Column [215]]: Attempt to parse the expression "(LTRIM([drawing e-location])== "Z:\\Gis\\SCAN DRAWINGS\\"" failed. The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.

  • Hello again,

    Sorry to hear that. I just had vague memories of seeing an error very similar to the one you are experiencing when I was working with file paths, and that double slashes did cure it for me.

    Unfortunately I don’t have any other bright ideas at the moment. Hopefully somebody else will.

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • Show us your derived column definition. It's saying that it cannot parse it.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Try a backslash to mask your expression:

    REPLACE(Reference,"Any \"string","Any string")

    However the expression seems to have some additional errors:

    (LTRIM([drawing e-location])== "Z:\Gis\SCAN DRAWINGS\"

    The first brace is not closed.

    The expression does no formatting, it returns a boolean result

    Z:\Gis\SCAN DRAWINGS\12345.tif" or "#Z:\Gis\SCAN DRAWINGS\12345.tif#". When trying to create a derived column to clean up the data and change it to http://blah/Maps/12345.tif, I get an error stating.....

    Try this:

    REPLACE(REPLACE([YourColumn], "#", ""),"Z:\\Gis\\SCAN DRAWINGS\\","http://blah/")

    Flo

  • I solved the issue by creating a user variable and putting Z:\Gis\SCAN DRAWINGS\ as the value. The expression will accept the user variable and my package runs as intended. Thanks to all for the help.

    Pwilson

  • Glad we could help.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

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

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