isaacr25
asked on
Help with update query
SQL Server 2000.
I have the following query which runs fine:
UPDATE MASTER55
SET API__bNumber = t2."EMP ID", [Has__bAPI__bMatch__bRun__ Q]='Yes'
FROM MASTER55 t1
JOIN [API].LaborWorkx_Live.dbo. vwCGHS_All _EmpList t2
ON t1.SSN = right(t2.SSN, len(t2.SSN) - 1)
AND t1.L__d__bName = t2."Last Name"
AND t1.F__d__bName = t2."First Name"
AND t1.mrREF_TO_MR Is null
AND API__bNUMBER Is null
AND [Has__bAPI__bMatch__bRun__ Q] Is null
However, I need to change it to achieve the following. I need the field [Has__bAPI__bMatch__bRun__ Q] to be set to Yes regardless of whether a successful match is made between the EMP ID and API__bNumber. This [Has__bAPI__bMatch__bRun__ Q] field will be used to tell whether or not the query has ran for that particular record, so it needs to be set to Yes each time the query runs, whether its successful or not in finding a match. Please advise. Thanks.
I have the following query which runs fine:
UPDATE MASTER55
SET API__bNumber = t2."EMP ID", [Has__bAPI__bMatch__bRun__
FROM MASTER55 t1
JOIN [API].LaborWorkx_Live.dbo.
ON t1.SSN = right(t2.SSN, len(t2.SSN) - 1)
AND t1.L__d__bName = t2."Last Name"
AND t1.F__d__bName = t2."First Name"
AND t1.mrREF_TO_MR Is null
AND API__bNUMBER Is null
AND [Has__bAPI__bMatch__bRun__
However, I need to change it to achieve the following. I need the field [Has__bAPI__bMatch__bRun__
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please see my last post. Thanks.
ASKER
Hello... anyone there?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I ran this code with 2 records, one where there was a matching API__bNumber, and one where there wasn't one. [Has__bAPI__bMatch__bRun__