Utilities > SQL Server Utilities > SQL Server Diagnostic Utility

SQL Server Diagnostic Utility

This program identifies potential problems with the SQL Server database used by SYSPRO companies.

It doesn't make any changes to the database, but identifies differences between the existing database and the standard SYSPRO tables, columns and indexes that should exist.

Database properties and company configuration information is also displayed.

Toolbar and menu

Field Description
File  
List
Option Description
Table verification details Includes table verification details when generating the report.
Index verification details Includes index verification details when generating the report.
Column verification details Includes column verification details when generating the report.
Foreign key verification details Includes foreign key verification details when generating the report.
Include  
Valid user defined columns This includes user defined columns in the display. Uncheck this option to speed up the validation process.
Function  
Generate Index Script This generates the script ADDKEY70.SQL in your working folder.
Generate Foreign Key Script

This generates the DROPFKEY70.SQL and REBUILDFKEY70.SQL scripts in your working folder.

Test Bulk Insert command  
Drop Foreign Keys This removes all existing standard SYSPRO Foreign Keys.
Rebuild Foreign Keys
Option Description
Start Rebuild

This rebuilds all standard SYSPRO Foreign Keys in the current database.

Ensure that all columns, tables and indexes are valid before selecting this option.

Start Rebuild for SQL Azure Only use this option when updating your database prior to migrating it to SQL Azure. The function effectively removes the NOT FOR REPLICATION clause when building the foreign keys as SQL Azure does not allow for replication syntax.

Foreign keys enable the database to enforce data integrity by allowing the definition of logical links between tables (e.g. a sales order detail table could have a foreign key to the sales order header table to ensure that each line added has a corresponding header row).

SQL Server Enterprise Manager (and some other software applications) can take advantage of Foreign Keys defined in the database to understand the logical links between tables. In addition, diagrams (sometimes called Entity Relationship diagrams) can be generated automatically using these logical links.

SYSPRO ships with an addition to the data dictionary that defines the logical links between tables. The physical file defining the links is stored beneath the server \BASE\DD folder as DDSFKY.DAT (and .IDX). When SYSPRO is installed on a SQL server-based system, this set of Foreign Keys is applied when the database is created. When migrating from prior versions, the Foreign Keys are automatically added.

Standard SYSPRO Foreign Key definitions begin with Syspro_ and must not be changed. You should also not add user-defined Foreign Keys beginning with Syspro_.

[Note]

The Foreign Keys defined have a WITH NOCHECK clause, which means that the Foreign Key is not used for data integrity purposes, as SYSPRO performs its own data integrity verification.

We strongly discourage you from adding your own Foreign Keys to a SYSPRO database (especially without the NOCHECK directive) as this could cause SYSPRO applications to fail unexpectedly.

SQL Server Configuration

Field Description
SQL Server Information  
System Information  
System Version

The System Version function shows the result of the SQL Server statement:

SELECT @@VERSION

Information about how long it takes to connect to SQL Server is displayed, along with the name of the ODBC driver being used. This may help support personnel diagnose specific problems.

The connection speed has a large effect when logging into SYSPRO, when using optimized SQL commands from within SYSPRO programs and when using e.net Solutions. The connection time should typically be less than 1/10th of a second (0.10 sec). Any connection speeds slower than this could lead to a significant degradation when using SYSPRO. If the connection speed appears slow, then it is recommended that you configure your ODBC data source on the server and check the time taken to test the connection. If this is also slow, then verify the protocols used to communicate with SQL Server to improve the speed.

Database Configuration  
SYSPRO Database Settings

The SYSPRO Database Settings function detects anomalies or inconsistencies between the SYSPRO Company Control files (?ADMCTL.DAT files), the SysproAdmin company/database cross-reference table and the SYSPRO company databases.

This function shows a list of all SYSPRO Company Control files (?ADMCTL.DAT) and collates a list of all the company/database cross references in SysproAdmin. The Database Information list view shows this information merged by company.

Verify Current Database These options are designed to deal specifically with the database associated with the current company.
OptionDescription
Verify Tables

Checks for missing standard SYSPRO tables and additional user-defined tables, including custom form tables.

Only tables which start with a capital letter are included in the selection.

This check includes:

  • Standard tables and columns (HealthCheckSqlStdTablesColumns.sql)

    This script checks the standard SYSPRO tables and columns for discrepancies.

    Note that the following standard SYSPRO tables are excluded from any checks as there is no definition for these in the data dictionary:

    • WposInvMasterBarcode: This is the single point of sale table that resides in the SYSPRO database.

    • Diag%: Tables beginning with ‘Diag’ are created in the conversion from 6.1 to 7.0 and are ignored.

    • Srs%: Any table beginning with ‘Srs’ are archive tables for SRS and are ignored.

    • %+: Tables with a plus sign at the end are seen as custom form tables and are checked in the custom form check script.

    • #: Tables with a hash sign at the end are new Harmony tables and are excluded

    • %+: Tables with a plus sign at the end are seen as custom form tables and are checked in the custom form check script.

  • Standard tables

    This checks the list of tables defined in the data dictionary against the tables in SQL to identify missing standard tables.

  • User defined tables

    This checks the list of tables defined in SQL and compares it with those in the data dictionary. Anything not in the data dictionary is seen as a user defined table.

  • Custom form tables

    Checks the custom form tables (those in the database with a plus “+” suffix are seen as custom form tables) and columns for discrepancies.

  • Standard custom form table

    When you associate custom form information against an entity such as Stock codes, then an entry is written into the custom form control table. Checks are made to find entries in the custom form control table that do not exist in the database.

  • User defined custom form table

    Any table found in the database with a “+” suffix that does not exist in the custom form control is seen as a user defined custom form table.

Verify Indexes

Checks that each standard SYSPRO table has a primary index and any alternate indexes. The diagnostic function validates the columns defined in the index, alternate and custom form indexes. This check also includes any mismatched columns.

We have discovered that a number of SYSPRO system administrators have attempted to use the SQL Server Data Transformation Services (DTS) wizard to copy one database to another and have used the default option to copy tables and their views. However, this does not copy indexes.

This check includes:

  • Standard SYSPRO table keys and indexes (HealthCheckSqlStdIndexes.sql)

    This script checks the indexes on all standard SYSPRO tables and compares them to their definitions in the data dictionary.

  • Standard indexes

    When a standard SYSPRO index does not exist on a table and it is the primary key, then this can allow duplicates to be written to the table which can lead to serious data corruption. Also, missing indexes can slow processing down as SQL reverts to a table scan when reading.

  • User defined indexes

    A number of customers may add user defined indexes to a standard SYSPRO table to improve performance on customised reports, etc.

Verify Columns

Checks that each standard SYSPRO column is defined appropriately and shows user-defined and custom form columns. User-defined columns are verified to ensure that they are compatible with SYSPRO.

This function also detects any data type discrepancies between the SYSPRO database and the SYSPRO data dictionary. The Actual and Expected columns values are displayed in the Data Information pane.

[Note]

This function may take several minutes to run as there are a large number of standard columns in a typical SYSPRO database. Ignore user-defined columns, by disabling the Valid user defined columns option, to improve the speed of the validation.

This check includes:

  • Standard columns

    The columns for standard tables are compared between what is in the data dictionary and in SQL itself. Any columns in the data dictionary, but not in SQL are considered missing.

    Note that all the standard tables have TimeStamp columns and whilst these are not defined in the data dictionary, they are checked to see whether they exist.

  • User defined columns

    A user defined column is one which is defined on a standard SYSPRO table which does not exist in the data dictionary.

    All user defined columns that are defined on a standard SYSPRO table must be set to either be NULLABLE or have a default value. If they do not, then this can cause failures inserting rows into the table using the standard file handlers as SYSPRO does not know of the existence of the user defined columns.

  • Column definitions vs SYSPRO definitions

    Checks are made between what SYSPRO is expecting the column to be defined as and how it is actually defined in SQL. Checks are made on the following column attributes and any differences found are reported with the Column definition does not match SYSPRO definition message:

    • Data type (e.g. varchar(100), decimal(18,6) or timestamp.

    • Column collation is checked against the database collation if the column is char, varchar, nchar and nvarchar).

    • Nullable property check. Most columns in SYSPRO (with the exception of datetime and GUID columns which are not in a primary constraint) cannot be NULL.

    • All columns in SYSPRO, except TimeStamp columns, have a named default constraint. Checks are made for no default constraint existing, constraint name differing OR default value differing to what is expected.

  • Custom form column definition vs SYSPRO definition

    Currently only the NULLABLE property is checked. Any key column cannot be nullable whereas all other columns must be set to nullable. Other checks, such as datatypes and collation, may be introduced at a later point.

  • Standard custom form columns

    Checks that any column that is defined in the custom form definition tables exist in the database. This checks both the primary ‘key’ columns (which link the custom form to the entity) as well as columns that are defined by the user.

  • User defined custom form columns

    Checks that columns defined on a custom form table are in the custom form definition.

    All user defined columns that are defined on a custom form table must be set to either be NULLABLE or have a default value. If they do not, then this can cause failures when SYSPRO processes these tables.

Verify Foreign Keys

Displays any missing standard SYSPRO foreign keys and any additional user-defined foreign keys.

This check includes:

  • Standard SYSPRO table keys and indexes (HealthCheckSqlStdIndexes.sql)

    This script checks the indexes on all standard SYSPRO tables and compares them to their definitions in the data dictionary.

    When a standard SYSPRO index does not exist on a table and it is the primary key, then this can allow duplicates to be written to the table which can lead to serious data corruption. Also missing indexes can slow processing down as SQL reverts to a table scan when reading.

  • Index column mismatch

    A check is made to ensure that all the columns that make up an index match the definition in the data dictionary. This includes columns missing from an index, columns in the incorrect sequence, or extra columns added to a standard SYSPRO index.

  • Index defined against incorrect table

    A check is made to ensure indexes which should be on one table, are not found to exist on another table. This usually occurs when the original master table is renamed in SQL. When a table is renamed then all the constraints, defaults, etc. remain. This will cause problems when trying to create the original table.

  • User defined index

    Customers may add user defined indexes to a standard SYSPRO table to improve performance on customised reports, etc.

  • User defined primary key

    A check is made to ensure that a table has only a single primary key and conforms to the data dictionary definition in naming terms. A primary key on a standard SYSPRO table is always named as {tablename}Key.

  • Custom form table indexes (HealthCheckSqlCustomIndexes.sql)

    All standard custom form tables have a primary key that links the table back to the original source document (for example InvMaster+ will have a key of InvMaster+Key which contains the ‘StockCode’ column).

    A number of customers may add user defined indexes to a custom form table to improve performance on customised reports, etc.

    This script checks for the following:

    • The primary key is not missing from the custom form table

    • All the columns that make up an index match the definition expected. This includes columns missing from an index, columns in the incorrect sequence, or extra columns added to the standard custom form index

    • Indexes which should be on one table are not found to exist on another table. This usually occurs when the original master table is renamed in SQL. When a table is renamed then all the constraints, defaults etcetera remain. This will cause problems when trying to recreate the original table.

  • Foreign key checks (HealthCheckSqlFkeys.sql)

    Foreign keys in SYSPRO are purely referential and are there to provide the ability to diagram the links between tables. They are not enforced, any enforcement of the foreign key rules are controlled programmatically within SYSPRO.

    Checks are made for the following:

    • All standard SYSPRO foreign keys between two tables exist.

    • User defined foreign key

      A foreign key exists between two tables, at least one of which is a standard SYSPRO table, that does not exist in the foreign key definitions in the data dictionary. As long as the foreign key is not enabled, this presents no problem.

      If a foreign key is enabled, then this can cause problems when SYSPRO attempts inserts/updates or deletes on the table.

    • Standard foreign key

      All foreign keys associated between SYSPRO tables must be disabled. Integrity between tables is maintained programmatically. If a foreign key is enabled then this can cause problems when SYSPRO attempts inserts/updates or deletes on the table.

    • Foreign key defined against incorrect table

      This occurs when a table is renamed in SQL. All objects associated with the table (keys, constraints, defaults etc.) will not automatically rename. This will cause problems when you try and rebuild the foreign keys in the database.

    • Foreign key column mismatch

      All the columns that make up a foreign key must match the definition in the data dictionary. This includes columns missing from an index, columns in the incorrect sequence, or extra columns added to a standard SYSPRO foreign key.

Database Information

The details displayed in this pane correspond to your selection in the SQL Server Configuration pane.

System Version

The following information is included in the Database Information pane for the System Version check:

Column Description
ODBC driver name This indicates the name of the ODBC driver being used, to help you identify whether the SQL Server generic driver or one of the 'SQL Server Native Client' drivers are in use.
Connection time The indicates how long it takes to connect to SQL Server.

If this is over 0.5 seconds, then this is too slow for normal SYSPRO performance. A message is displayed indicating that if you are using an ODBC DSN, then you should view the Client Configuration information and consider using the TCP/IP network library.

SYSPRO Database settings - Status

When selecting the SYSPRO Database Settings option, the Status column in the Database Information pane identifies any anomalies.

In order of priority, the following status conditions may be displayed:

Status Description
No Matching ADMCTL Indicates that an entry in the SysproAdmin table has been found but that there is no matching Company Control File (?ADMCTL.DAT).

This usually occurs when a test or temporary company has been added in SYSPRO and the Company Control file (?ADMCTL.DAT) has been subsequently deleted, but the SysproAdmin table has not been changed.

If this is the case, then to tidy up you should delete the row in the SysproAdmin table and delete the remaining database for that company - ensure that this is the correct database before deleting it. If in doubt consider renaming it with a .old extension.

Cannot connect to database Indicates that both the Company Control File (?ADMCTL.DAT) and SysproAdmin table match, but the database is inaccessible. It's possible that the database has been renamed or dropped. It's possible that the company was created as a test or temporary company that is no longer needed.

If this is the case, then to tidy up you should delete the Company Control file (?ADMCTL.DAT) and other related files and then manually remove the corresponding rows from the SysproAdmin table.

Database does not match ADMCTL Indicates that the database name in the Company Control file (?ADMCTL.DAT) does not match the equivalent row in the SysproAdmin table.

If the SysproAdmin table database name is incorrect then manually change the DatabaseName column in the SysproAdmin table to show the correct database name.

However, if the database name in the Company Control file is incorrect then load SYSPRO, change the company and edit the database name, save and exit, and try re-running this diagnostic option to ensure that it has been corrected.

Case insensitive database SYSPRO is not designed to work on a case-insensitive database. If you see this status you must not use this database for SYSPRO.
Version incorrect Indicates that the Company Control File (?ADMCTL.DAT) contains a version that does not correspond to the current system version. This may occur when you are in the process of migrating companies from one SYSPRO version to another and have not yet converted all the companies.
No matching SysproAdmin Indicates that the Company Control File (?ADMCTL.DAT) exists for a SQL Server-based company, but no matching row in the company/cross-reference table SysproAdmin has been found.

This can happen when an end-user attempts to copy an existing database to a new name and they attempt to use the newly-copied company. In this case, it will be necessary for an appropriate row to be manually added to the SysproAdmin table.

In addition to the above statuses, any C-ISAM-based companies are also included in the list of companies. This may serve to highlight either test or temporary companies that are to be deleted, or companies that have not yet been migrated to SQL Server.

Verify Tables

The following Exception messages may be displayed in the Database Information pane for the Verify Tables function:

Exception message Description
Standard table missing A standard SYSPRO table is not defined in the company database. This is a serious problem. Contact your local SYSPRO support agent to correct this situation.
User defined table A table is defined in the company database that is not defined in the data dictionary and is not recognised as a SYSPRO table.
Standard custom form table missing SYSPRO was setup to use a custom form table and this does not exist in the database.
User defined custom form table A table with a '+' suffix exists in the database that is not recognised as a standard custom form table.

Verify Columns

The following Exception messages may be displayed in the Database Information pane for the Verify Columns function:

Exception message Description
Standard column missing Indicates that a standard column is missing from. This can indicate that the database has not yet been migrated to the current version of the software.

This is a serious problem because when SYSPRO programs use the table they will expect this column to exist. Contact your local SYSPRO support agent to correct this situation.

User defined column A user defined column has been defined on a SYSPRO table but is valid.
Column definition does not match SYSPRO definition A standard column in the database has properties that do not match what is expected by SYSPRO. The properties checked are as follows:
  • The column data type and length

  • The column's collation

  • The nullable option on the column

  • The default constraint name differs

  • The default constraint value differs

The discrepancies are checked in the above sequence and the first difference is output in the Expected and Actual columns in the listview.

These differences can cause serious issues in SYSPRO and need to be rectified.

User column detected - ok Indicates that a user-defined column has been found (it's not a standard SYSPRO column) and the column will not cause a problem for SYSPRO programs.

If a user-defined column is not required then it is recommended that you drop it manually so as not to conflict with possible future SYSPRO columns.

User column detected - not null Indicates that a user-defined column has been found (it's not a standard SYSPRO column) and that the column has been defined as NOT NULL.

This is a serious problem when the column is defined in a SYSPRO table and needs to be corrected so that the column is NULLABLE.

User defined column not nullable and has no default property The user defined column must either be nullable or have a default property.
User defined column not nullable and has no default constraint A user defined column exists on a standard SYSPRO table and because it is not set to NULLABLE and does not have a default constraint, it will cause problems when SYSPRO attempts to write to the table.
Collation does not match default This message indicates that the collation of the column does not match the database itself.

This can lead to a serious problem when future columns are added to the database, as SYSPRO does not support mixed collation between columns.

Incorrect data size Indicates that there is a data size discrepancy between the SYSPRO database and the SYSPRO data dictionary. This discrepancy is indicated in the Actual and Expected columns.
Column default property mismatch Indicates that the default property expected does not match the settings in SQL - checks are made against the name of the property and the default value set.
Column nullable property mismatch Indicates that the nullable property expected by SYSPRO does not match the actual setting in SQL.
Standard custom form column missing A column was defined against the custom form table in SYSPRO, but it does not exist in the table itself in SQL.
User defined custom form column A column exists against the custom form table that is not part of the custom form definition in SYSPRO.

Verify Indexes

The following Exception messages may be displayed in the Database Information pane for the Verify Indexes function:

Exception message Description
Standard index missing A standard index does not exist on the SYSPRO table. This can have a serious effect on the performance of the system.
User defined index An index has been defined on a SYSPRO table which is non-standard. This is for information purposes only and should not have any effect in SYSPRO.
Index column mismatch An index is defined with specific columns in SYSPRO in a specific sequence. This indicates that either the index is missing columns, has extra columns, or the columns are not in the expected sequence.
Standard custom form index missing A standard index does not exist on the custom form table. This can have a serious effect on the performance of the system.
User defined custom form index An index has been defined on a custom form table which is non-standard. This is for information purposes only and should not have any effect in SYSPRO.
Custom form index column mismatch The index on the custom form table does not match the index expected by SYSPRO. This can have an effect on the performance in SYSPRO.

Verify Foreign Keys

Within SYSPRO, foreign keys are used for reference purposes only.

The following information is included in the Database Information pane when you select to Foreign Keys:

Exception message Description
Standard foreign key is enabled A standard SYSPRO foreign key has been enabled. This can cause serious issues in processing as all links in SYSPRO are handled within the application and not SQL.
User defined foreign key is enabled A user defined foreign key that links to a standard SYSPRO table is enabled. This can cause serious issues in processing in that this can prevent modification of the information on the table.
Foreign key mismatch A standard foreign key that is defined does not have the expected columns defined, or the columns within the foreign key are in a different sequence to what is expected by SYSPRO.
Standard foreign key missing A standard foreign key does not exist on the SYSPRO database.
User defined foreign key A user defined foreign key has been defined which links to a SYSPRO table.

Notes and warnings

Restrictions and limits

  • When issuing SQL statements to query objects in the database (e.g. tables, indexes and columns) only the standard default schema (dbo) is searched.

    User schemas (which could potentially contain objects with the same names as standard SYSPRO objects) are ignored.