I am in brain stroming situation. I thought, lets explain to geeks, So they can help me to resolve this problem.I have table called Sharepoint_Users in Oracle. (see below format and data). I have access oracle db from linked server.Don't worry about it. Just consider it is sql table.SharePoint_UsersID Status1 Active2 InActive3 Active4 InActive
another two tables called aspnet_user and aspnet_UsersInRoles in SQL server.aspnet_usersUserID UserName A7DFDDAE-4DB8-476D-9C29-677763406F71 1D9910E14-9206-4460-88CA-4C39DE620192 2F188B1DF-03A6-4332-BA89-3B3C6682E9BA 3728E77E7-693A-4015-92CA-02F0A403C29A 4
asnet_usersInRolesUserID RoleIDA7DFDDAE-4DB8-476D-9C29-677763406F71 InActiveD9910E14-9206-4460-88CA-4C39DE620192 Active
Now here is the challenge. - When users status changes in SharePoint_Users table from 'Active' to 'InActive' OR 'InActive' to 'Active'. We need to update same users RoleID in asnet_usersInRoles table.
- And also I need insert new records those not exists in asnet_usersInRoles table but exists in aspnet_users table. If user not found in aspnet_users should not insert them into asnet_usersInRoles. (always users will be the same SharePoint_Users and aspnet_users)
Please help me out write a sp to get it done. I will run job for this sp every 1 hr to update.