Replace single quote (') to double quotes RRS feed

  • Question

  • Hi all,

    IN my SSIS package I am using 1 execute sql task , which I am using to store the value of PARTNM in to 1 variable called User::VarPartnm.

    I am getting value like MCD'S in VarPrtNm variable.

    Now I have to use above variable in where clause , so above value not allow because of single quotes

    I want to replace the VarPartNm variable and I should get the value like MCD''s

    kindly help me to get the desired output

    Thankx & regards, Vipin jha MCP

    Thursday, July 28, 2016 10:16 AM


  • Hi Vipin,


    Just as Uri Dimant said, you could replace the single quote (') to double quotes by using a SQL Statement.


    But for replacing a single quote ('), you need to modify the SQL Statement with a little modification.

    select replace(@aa,'''','"')


    In addition, you also could use an expression in a new variable to replace the single quote ('), then reference the new variable in where clause.



    • Marked as answer by Vipin jha Friday, July 29, 2016 7:00 AM
    Thursday, July 28, 2016 11:50 AM

All replies