• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Update Trigger

I though this trigger worked but it does not.  The trigger below will not update the all the records that have
the same familyid it will only update one record.  the strPatientid.  Any suggestions.

thanks

UPDATE    DEN
    SET  CONSENTDATE = inserted.dtmEligExpires
    FROM BCSQL.dentrix.dbo.DDB_PAT_BASE AS DEN
       INNER JOIN inserted ON DEN.CHART =inserted.strPatientid
    WHERE DEN.FamilyID = (SELECT FamilyID FROM BCSQL.dentrix.dbo.DDB_PAT_BASE as DEN                    
                        WHERE DEN.Chart = inserted.strPatientID)
0
running32
Asked:
running32
  • 2
  • 2
1 Solution
 
rafranciscoCommented:
Try this one:

UPDATE    DEN
    SET  CONSENTDATE = inserted.dtmEligExpires
    FROM BCSQL.dentrix.dbo.DDB_PAT_BASE AS DEN
       INNER JOIN inserted ON DEN.FamilyID =inserted.FamilyID
0
 
running32Author Commented:
There is no familyid in the inserted table only the strPatientid which references the chart field in the den database.

Thanks
0
 
rafranciscoCommented:
UPDATE    DEN
    SET  CONSENTDATE = inserted.dtmEligExpires
    FROM BCSQL.dentrix.dbo.DDB_PAT_BASE AS DEN
       INNER JOIN BCSQL.dentrix.dbo.DDB_PAT_BASE AS DEN2 ON DEN.FamilyID = DEN2.FamilyID
       INNER JOIN inserted ON DEN2.CHART =inserted.strPatientid
0
 
running32Author Commented:
Perfect.  Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now