·
1 min read

EXTERNAL as field name in SQL Server 2005

Maybe you already ran into the issue that you are using Dynamics AX 4.0 SP1 with SQL Server 2005. You are trying to create a new table in AOT with a column called “external”.

You recognize, that during the synchronization of the table with SQL Server the following error messages are shown in the InfoLog:

Error Synchronize Cannot execute a data definition language command on (). The SQL database has issued an error.

Info Synchronize SQL error description: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword ‘EXTERNAL’.

Info Synchronize SQL statement: CREATE TABLE “DBO”.TABLE1 (EXTERNAL NVARCHAR(10) NOT NULL DEFAULT ” ,DATAAREAID NVARCHAR(3) NOT NULL DEFAULT ‘dat’ ,RECVERSION INT NOT NULL DEFAULT 1 ,RECID BIGINT NOT NULL CHECK (RECID <> 0) )

Error Synchronize Problems during SQL data dictionary synchronization. The operation failed.

Info Synchronize Synchronize failed on 1 table(s)

The reason for this is, that with SQL Server 2005 “external” was introduced as a new keyword (used with “CREATE FUNCTION”).

Reserved Keywords (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms189822.aspx

CREATE FUNCTION (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms186755.aspx

The solution for this is to rename your column to a different name and not to use “external” as column name anymore.

–author: Alexander Lachner
–editor: Alexander Lachner
–date: 29/04/2009