locked
ssis variables value about " RRS feed

  • Question

  • hi my friends:

         when I do a ssis program develop,I encounter a problem.I set three variable,  V_A,whose  VALUE: ";V_B ,whose value:|;

    V_C , whose value is V_A+V_B+V_A, I caculate and the value of V_C if "|" .after that I use V_C in a expression like :

    REPLACE(["id"|"name"|"desp"],@[User::V_C],","),but the result is that it can not replace ","  that 's why. 

    and if I change the expression REPLACE(["id"|"name"|"desp],"|",","), and the result is right.

    can any friend can give me a reply.

    thanks a lot!

    ming

    Sunday, August 10, 2014 2:52 PM

Answers

  • Hi ming,

    So, my understanding is that you want to replace | with comma, and the | must be between double quotes. Right?

    That, the expression can be:
    REPLACE(["id"|"name"|"desp],@[User::V_C], "\",\"")

    It means, we replace the whole "|" with "," (Both is with double quotes outside).

    Check the following example:
      

    Thanks,
    Jinchun Chen


    Monday, August 11, 2014 9:30 AM
  • HI jinchun chen:

               your understand is right. I will have a try soon.

    thank you very much.            

    • Marked as answer by minghuang Tuesday, August 12, 2014 3:19 AM
    Tuesday, August 12, 2014 3:19 AM

All replies

  • Hi ming,

    Suppose the "id"|"name"|"desp is a string, not a column(or exprssion) name. You want to replace | with , . If I have misunderstood, please don't hesitate to let me know.

    To replace the | with comma, please use | directly as the search expression. For example:

    REPLACE("\"id\"|\"name\"|\"desp\""],@[User::V_B],",")

    Thanks,
    Jinchun Chen


    Monday, August 11, 2014 7:57 AM
  • Are you able to evaluate the expression : REPLACE(["id"|"name"|"desp"],@[User::V_C],",") 

    Both of the expressions are incorrect. If you want to do the following:

    • To replace : "|"
    • To be replaced from : "id"|"name"|"dep
    • Replace with: ,

    then either create the To be replaced from string properly in the expression or add another variable V_D and set its value as "id"|"name"|"dep

    Now you can use both V_C and V_D inside the expression as: 

    REPLACE( @[User::V_D], @[User::V_C],",")

    Or use: REPLACE( "id\"|\"name\"|\"dep\"|\"", @[User::V_C],",")

    If you want to replace in a source column then use:REPLACE( [Column Name], @[User::V_C],",")


    Nitesh Rai- Please mark the post as answered if it answers your question



    • Proposed as answer by kumarvik Monday, August 11, 2014 8:30 AM
    • Edited by Nitesh Rai Monday, August 11, 2014 9:00 AM
    Monday, August 11, 2014 8:16 AM
  • HI jinchun chen

        "id"|"name"|"desp" is a column,why is a column display like this that has a special reason. and I want to change string such as "aaaa"|"bbbb"|"cccccc"  to "aaaa","bbbb","cccccc" . as signs | likely appear in string "aa|aa"|"bbbb"|"cccccc" ,I must replace "|" with ",". and I want to use variables to realize. can you help me?

    thank you!

    Monday, August 11, 2014 8:45 AM
  • Hi ming,

    So, my understanding is that you want to replace | with comma, and the | must be between double quotes. Right?

    That, the expression can be:
    REPLACE(["id"|"name"|"desp],@[User::V_C], "\",\"")

    It means, we replace the whole "|" with "," (Both is with double quotes outside).

    Check the following example:
      

    Thanks,
    Jinchun Chen


    Monday, August 11, 2014 9:30 AM
  • HI jinchun chen:

               your understand is right. I will have a try soon.

    thank you very much.            

    • Marked as answer by minghuang Tuesday, August 12, 2014 3:19 AM
    Tuesday, August 12, 2014 3:19 AM