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 |
nha001
Starting Member
2 Posts |
Posted - 2014-03-11 : 01:36:00
|
Hi I am new to MSSQL server. I have problem in migration from ORACLE trigger to MSSQL server. Here below the trigger in Oracle..<<--------Trigger Begin----------->>create or replace TRIGGER transactiontrigger After INSERT ON ORDERINVOICEFOR EACH ROW BEGIN update A_ACCOUNT set A_ACCOUNT.AC_RUNNING_BLC=(A_ACCOUNT.AC_RUNNING_BLC-:new.NETAMMOUNT+:new.COMMISION-:new.TDS)where A_ACCOUNT.A_ID=:new.A_ID;END;<<---------Trigger END-------->>Could you some one help me to transform the trigger in MSSQL compatible.Nilotpalhazarika |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-03-11 : 05:24:23
|
in MS SQL trigger would be as belowcreate TRIGGER transactiontrigger ON ORDERINVOICEAfter INSERT ASBEGIN update aset a.AC_RUNNING_BLC=(a.AC_RUNNING_BLC - i.NETAMMOUNT + i.COMMISION - i.TDS)FROM A_ACCOUNT aINNER JOIN INSERTED iON i.A_ID= a.A_IDEND; MS SQL triggers work on basis of two internal table INSERTED and DELETED which will contain old/new values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
nha001
Starting Member
2 Posts |
Posted - 2014-03-11 : 09:15:26
|
Thank you for you help!Nilotpalhazarika |
 |
|
|
|
|