Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2010-09-24 : 09:58:12
|
Currently I am updating user_def_fld_3 with bol_no, I also want to update another field called ar_reference but I want to concatenate the bol_no at the beginning of this field because there will already be data in it. Is this possible??ar_reference will have data like: Our Ref: PO002During my update I would like to take the "Our Ref: PO002" and addBOL: {field_name} to the front of it.So that the ar_reference will look like this:BOL: 234 Our Ref: PO002beginupdate oeordhdr_sqlset oeordhdr_sql.user_def_fld_3 = inserted.bol_nofrom inserted INNER JOIN oeordhdr_sql on inserted.ord_no = oeordhdr_sql.ord_noend |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-24 : 10:06:43
|
assuming all involved columns are character datatypes (else a convert would be needed):beginupdate oeordhdr_sqlset oeordhdr_sql.user_def_fld_3 = inserted.bol_no, oeordhdr_sql.ar_reference = 'BOL: '+ inserted.bol_no + ' ' + isnull(oeordhdr_sql.ar_reference,'')from inserted INNER JOIN oeordhdr_sql on inserted.ord_no = oeordhdr_sql.ord_noend No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|