Help with Parsing a Simple Expression from SSIS

  • This might not be the right place for this, wasn't sure exactly where to post this question.

    I have the following expression which i'm trying to parse. There is a variable which needs to be passed into the insert statement, the variable needs to be wrapped in SINGLE QUOTES in order for the query and the corresponding SQL task to work. I've completely forgotten how to do this in SSIS and nothing I try seems to work.

    This is probably very simple, can someone show me how?

    My expression:

    "INSERT INTO XMLImport (XMLFile, LoadDate)

    SELECT CONVERT(XML, BulkColumn) as BulkColumn, GetDate()

    FROM OPENROWSET(BULK " + @[User::XMLFilePath] + " , SINGLE_BLOB) as X"

    What I need:

    INSERT INTO XMLImport (XMLFile, LoadDate)

    SELECT CONVERT(XML, BulkColumn) as BulkColumn, GetDate()

    FROM OPENROWSET(BULK 'C:\XML\Books.xml', SINGLE_BLOB) as X

  • This should work:

    "INSERT INTO XMLImport (XMLFile, LoadDate)

    SELECT CONVERT(XML, BulkColumn) as BulkColumn, GetDate()

    FROM OPENROWSET(BULK '" + @[User::XMLFilePath] + "' , SINGLE_BLOB) as X"

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

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