SET Concatenate problem?????

  • Hello,

    I am updating a table with a set comand and want to add the string 'REPLACED BY ' to a field in a table and add to this a value from a seperate table.

    I wrote the following and it gives me an error for the | value. What am I missing?

    UPDATE    CapRepair

    SET              Caprepair.information = ('REPLACED BY ' | | yorkmfgnumberss022405.mfgnumber)

    FROM         CapPart INNER JOIN

                          YORKMFGNUMBERSS022405 ON CapPart.PartID = YORKMFGNUMBERSS022405.PartID INNER JOIN

                          CapRepairLinkPart ON CapPart.PartID = CapRepairLinkPart.PartID INNER JOIN

                          CapRepair ON CapRepairLinkPart.RepairID = CapRepair.RepairID

    Thanks in advance!

    JBL

     

     

  • try

    'REPLACED BY ' + CAST(yorkmfgnumberss022405.mfgnumber AS VARCHAR())

    Is it normal that you don't have a where condition in this update.. or is the where condition contained in the inner joins?

  • Remi,

    Thanks for the help, and yes a WHERE comand is standard but the table I am importing to is already filtered with all preceeding where comands. If the repairID which is the Key unique number mathces in the table then the UPDATE SET should have no need of a WHERE clause, correct?

    I tried this and I get a syntax error for ')' the ) is only used in the above statement why the syntax error, they all match?

    JBL

  • My mistake... I had put VARCHAR(enter size here) between > and < and it was interpreted as html by the browser. Just make sure that the size you enter is big enough for the number that is being converted: especially if it's a decimal (I know it must be an id but..).

    I was just referring to the where clause to make sure you were not updating the whole table by error.

  • Remi,

    Who is the id, I should have placed the length. Thanks it worked like a charm!

     

    JBL

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

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