Correcting Invalid SQL Syntax

Some SQL syntax in Sybase IQ 15 is different that previous versions and can cause iqunload failures.

Troubleshooting schema issues

Problem

Solution

A DECLARE LOCAL TEMPORARY TABLE statement in a procedure or trigger causes a syntax error if the table name is prefixed with an owner name.

Remove the owner name.

If a CREATE TRIGGER statement does not include an owner name for the table on which the trigger is defined, and the table must be qualified with an owner when referenced by the user executing the reload.sql file, the statement fails with a Table ‘table–name’ not found error.

Prefix the table name with the owner name.

If an object name (such as a table, column, variable or parameter name) corresponds to a reserved word introduced in a later version of Sybase IQ or SQL Anywhere (such as NCHAR), the reload fails. (For reserved words, see Sybase IQ Reference: Building Blocks, Tables, and Procedures and SQL Anywhere Server SQL Reference.) For example:
CREATE PROCEDURE p( )
BEGIN
DECLARE NCHAR INT;
SET NCHAR = 1;
END

Change all references to the reserved word to use a different name. For variable names, prefixing the name with @ is a common convention that prevents naming conflicts.

Views that use Transact–SQL® outer joins (by specifying *= or =*) may not be created properly when they are reloaded.

Add the following line to the reload script:
SET TEMPORARY OPTION
tsql_outer_joins='on'
Also set this option for your database. Rewrite any views or stored procedures that use Transact–SQL outer joins.

Stored procedures that use Transact–SQL outer joins may not work correctly.

Rewrite views and stored procedures.

Functions that have OUT or INOUT parameters cannot be reloaded.

OUT and INOUT parameters are no longer supported. Drop these functions before reloading.

Related tasks
Running iqunload -n
Related reference
Addressing Unsupported Objects