Handy Library Manager
 for Windows


.. > Library backup, restore, maintenance. > Organize, Execute SQL Statement > How to set the CALL value from the author's last name?


Run SQL Example; How to set the CALL value from the author's last name? (new in version 4.0)

You can use the Run SQL function to set the value of the CALL data field.

For example, you can execute the SQL command so the CALL data field will contain three first letters from the author's last name. Later, you can include the CALL data field when you define your spine labels.

run sql command, how to access

In this case, author entries are in the "last name, first name" format.


You can execute a command that takes the three first characters from the entry, changes them to upper cases, and saves them in the CALL data field.

UPDATE LIBRARY_NEW SET CALL = UPPER(SUBSTRING(AUTHOR from 1 for 3))


In this case, author entries are in the "first name last name" format.


You can execute a command that takes the three first characters from the "last name" part, changes them to upper cases, and saves them in the CALL data field.

Retrieves last name and saves into the CUSTOM2 data field:
UPDATE LIBRARY_NEW SET CUSTOM2 = SUBSTRING(AUTHOR from CHAR_LENGTH(AUTHOR)-(POSITION(' ' in REVERSE(AUTHOR))-2) for POSITION(' ' in REVERSE(AUTHOR)))

After reviewing values in the CUSTOM2, run this:
UPDATE LIBRARY_NEW SET CALL = UPPER(SUBSTRING(CUSTOM2 from 1 for 3))


Use the CUSTOM VIEW feature: you can define a SELECT statement to review results before you execute the SQL command that modifies data values. The SELECT definitions create and display a temporary table.

SELECT AUTHOR, UPPER(SUBSTRING(AUTHOR from 1 for 3)) AS CALL1 FROM LIBRARY_NEW




Copyright © 2024 · All Rights Reserved · PrimaSoft PC