PSLine2000Documentation/Queries/MAKEW1.md

1.9 KiB

MAKEW1

Analysis generated on: 4/2/2025 10:02:50 AM

SQL Statement

UPDATE Process SET Process.STSCode = "W"
WHERE (((Left([PartNumber],3))="900"));

Dependencies

  • None

Parameters

  • None

What it does

SQL Update Statement

Description

The provided SQL update statement modifies the STSCode field in the Process table based on a specific condition related to the PartNumber.

Breakdown

UPDATE Clause

  • The UPDATE keyword is used to specify that we want to modify existing data in the database.
  • In this case, we are updating the Process table.

SET Clause

  • The SET keyword is used to specify which fields need to be updated.
  • Here, we are updating the STSCode field of the Process table.

SET STSCode = "W"

  • We are assigning a new value ("W") to the STSCode field.
  • This update will apply this new value to all rows in the Process table where the condition is met.

WHERE Clause

  • The WHERE keyword is used to specify conditions that must be true for the update to occur.

  • In this case, we have a complex condition involving multiple criteria:

WHERE (((Left([PartNumber],3))="900"));


    *   This condition uses the `LEFT` function to extract the first 3 characters from the `PartNumber`.
    *   It then checks if these extracted characters are equal to "900".
    *   The double parentheses (`( )`) indicate that this is a composite condition, which means it will be evaluated as a single expression.

### Logic

The update statement will apply the new value ("W") to the `STSCode` field of all rows in the `Process` table where:

*   The `PartNumber` has 3 or more characters (since we're extracting the first 3 characters).
*   The first 3 characters of the `PartNumber` are "900".

This means that only parts with part numbers starting with "900" will have their `STSCode` updated to "W".