A user wants us to update a table called Final Subdel Database with a file they are going to start giving to us on a semi annual bases. I am not sure how to do this without messing anything up. Any advice would be great.
Let me give you an example, here is the query below from the table I need to update. The only two fields that I will need to update will be "Initial Credentialing" and "Last Credentialing Date". The primary key in both tables would be the "PCS Number".
[PCSNumber],[Sub Del Name],[Last Name],[First Name],[M# Initial],Degree,[Social Security], DOB],Specialty,NPI,TIN,Type,[Initial Credentialing Date],[Last Credentialing date]
The date fields are nvarchar.
This is where it get tricky for me.
If the date on the master database " Final_Subdel_Database" is current compared to the one that is on the new file "SubdelJanJune" then we are suppose to keep the date on the master database " Final_Subdel_Database".
If the date on the new file called "SubdelJanJune" is current then I need to override the date that is on the Master table.
3> If the date on the New file called "SubdelJanJune" is NULL then keep what is on the master file or if the Master file is null add the date from the new file.
How can I do this without making duplicate lines and just updated that field that is linked to that PCS Number?
Thanks in advance!