.. > Backup, Restore, Maintenance. > Backup, Restore, Miscellaneous > How to organize, execute SQL statement?


Organize, Execute SQL Statement (new in version 4.0)

You can prepare and execute a SQL statement. Handy Equipment-Tool Manager is using Firebird SQL database system.

  • Be careful when running SQL statements. You can easily modify or delete all records in your equipment and tool databases by mistake.
  • Do not use any commands that change the structure of the database (add new or delete existing fields, rename field names, create new or delete existing tables).
  • Before you run any SQL statement, create a backup file.

The Run SQL Statement function supports the following:

  • prepare SQL statement and execute it
  • define SQL statement and save it for future use
  • select the SQL statement from the list and execute it
equipment database, run sql command, how to access e" src="images/run-sql-statement-how-to-access.jpg" width="700" height="493" alt="run sql command, how to access"/>

Run SQL Example

For example, you use our Handy Equipment-Tool Manager at school. Your borrowers are students. At the beginning of the new school year, you can run the SQL function to upgrade your students’ grades. In the Borrowers table, you store the student grade in the CUSTOM1 data field. You want to update your student data at the beginning of the new school year. It will involve:

  1. delete last grade students (do it in the BORROWERS table)
  2. upgrade grades for remaining students (use Run SQL Statement)
  3. enter first-grade students (enter manually or use import)
example, run sql statement, upgrade student grades
After deleting the last grade students, you can use the following SQL statement (1) to upgrade student grades. The WHERE close (2) specifies which records are updated and what a new value is assigned.
Notes:
- The order of the update statements is critical in this case.
There are four grades stored in the CUSTOM1 data field: Grade 1, Grade 2, Grade 3, and Grade 4.

organize sql statements

Organize, Execute SQL

Enter SQL statement into the SQL Statement box (1).

Click Execute SQL (2) to execute the statement from the SQL Statement box (1).

Click Save, Organize SQL (3) to save the SQL statement for future use.

Click on the Saved SQL Statements dropdown box (4) to select the previously saved SQL statement.



Questions:



 

Latest calibration management articles:


Copyright © 2023 · All Rights Reserved · PrimaSoft PC