Forum Discussion

eynarain's avatar
eynarain
Brass Contributor
Aug 07, 2020

SQL Server Merge a javascript list with a table

I have a javascript object containing a bunch of user info that's sourced from Microsoft Teams team member list. I want to merge this object to a SQL table at predefined intervals. The team members of a team may be added/removed via Teams UI by users. However, my requirement is to keep the user table in SQL in sync will the actual team member list in Teams. I need a way to merge this list into the SQL table such that any existing users in the object kept intact in the db, any additional users are added and any unlisted users are removed from the db. I believe SQL merge operation could achieve this but that one works only if both the source and destination are tables.

 

Any idea how to achieve this when the source is a javascript object and destination is a table?

Resources