If you don't have the permission to generate script according to an existing db, but you have the read permission for that db, if so you can use select to generate the expceted insert/delete/update statements, furtherly, you can also do complicated c…
Create Trigger [dbo].[upemployee_kefyu_sale] on [dbo].[employee] for update as if update(FullName) begin update erp.dbo.kefupp set erp.dbo.kefupp.saleperson =e.Fullname from [employee] e where e.typeid = erp.dbo.kefupp.etypeid update erp.dbo.salesper…
merge into的形式: MERGE INTO [target-table] A USING [source-table sql] B ON([conditional expression] and [...]...) WHEN MATCHED THEN [UPDATE sql] WHEN NOT MATCHED THEN [INSERT sql] 作用:判断B表和A表是否满足ON中条件,如果满足则用B表去更新A表,如果不满足…