Background:
I'm a beginner developer learning when to use the app and when to use the DB to execute what I need. I have two tables in separate databases with employee data. I need to set my asp.net application variable to today so a sp would run based on that.
Question:
The sp needs to check for empid in Table B. If exists update based on info in Table A if not found insert from Table A.
I have this update statement
I just don't know how to say in SQL, if empuserid found update if not insert.
Thanks for your assistance.
I'm a beginner developer learning when to use the app and when to use the DB to execute what I need. I have two tables in separate databases with employee data. I need to set my asp.net application variable to today so a sp would run based on that.
Question:
The sp needs to check for empid in Table B. If exists update based on info in Table A if not found insert from Table A.
I have this update statement
Code:
UPDATE dbo.employee SET full_name = t.full_name, cost_center = t.cdcstcntr, cost_center_desc=t.desccstcntr, job_title=t.job_title, supervisor=t.supervisor_name FROM dbo.v_WQTimeEmployees as t RIGHT OUTER JOIN dbo.employee ON t.empUserID = dbo.employee.NTUserID WHERE t.empUserID = dbo.employee.NTUserID AND (dbo.employee.manual IS NULL or dbo.employee.manual=0)
Thanks for your assistance.
Comment