createproceduresp_invtbl_populated(@tblnamevarchar(64)) as begin /* procedure will be call after bulk insert into an inv table because during bulk insert trigers are disabled
@param tblname full qualified table name e.g. ca_itrm.inv_xxx_item */
declare@sqlvarchar(255);
set@sql='update '+@tblname+' set tenant_id=a.tenant_id from ca_agent a ' +' where a.object_uuid = object_uuid';
exec@sql;
end; GO GRANTEXECUTEON[dbo].[sp_invtbl_populated]TO[ca_itrm_group] GO