UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> UPDATE    

The general syntax for an UPDATE query is:

SQL
UPDATE TableA SET FieldA = SomeValue WHERE criteria


The following example, omitting the optional criteria, will set the isActive field in the Personnel table to true for ALL records:

SQL
UPDATE tblPersonnel SET isActive = True


The following example uses criteria to set the isActive field in the Personnel table true only where the EmploymentEndDate field has not been populated:

SQL
UPDATE tblPersonnel SET isActive = True WHERE EmploymentEndDate IS NOT NULL

UPDATE queries can also be performed on joined tables. The following example clears the DefaultProject flag in the Assigned Projects table for all employees with a last name of Smith in the personnel table:

SQL
UPDATE tblPersonnel INNER JOIN tblAssignedProjects ON tblPersonnel.EmployeeID = tblAssignedProjects.EmployeeID
SET tblAssignedProjects.DefaultProject = False WHERE tblPersonnel.LastName = 'Smith'
Edit Discussion
Custom Search


Thank you for your support!
This page has been accessed 686 times.  This page was last modified 14:13, 22 March 2018 by mbizup.   Disclaimers