[MSSQL] UPDATE from code match in SQL Server

UPDATE from code match in SQL Server
View join / update 



Create Trigger ink_quote_dropdown_to_text
on odm_ink_quote For insert
--When easyflow odm_ink_quote add new form , on trigger
as
Begin

Update ink_quote
--update data odmotccus to ink_quote
set ink_quote.com_text    = (b.companycode+b.companyname),
    ink_quote.sal_text    = (b.salcode+b.salname),
    ink_quote.client_text =(b.clientcode+'('+b.clientabb+')
    (condition : '+b.tracurrency+b.creditsline+')-upto90day : '+b.creditsmon),
    odm_ink_quote.sel_text    = (b.selquantity+'KG')
--Update Table companyname/salname/clientname/selquantiy to text(column)
from  ink_quote a
inner join V_ink_quote_01 b
--join View
on
a.client_code=b.clientcode

where com_text  is NULL
and   sal_text  is NULL
and client_text is NULL
and   sel_text  is NULL
and   a.client_code=b.clientcode
and   a.company_code=b.companycode
and   a.sal_code=b.salcode
and   a.sel_quantity=b.selquantity
--condition cortrol update range
End



這個網誌中的熱門文章

[MSSQL] 一行指令,快速複製資料表(TABLE)

[Windows] 連線網路磁碟機 設定及BAT檔製作

[C#] 撰寫C#連接Mssql 資料庫方法 C# connect to mssql