Error message when you use the correct syntax of the CREATE TYPE statement in SQL Server 2005: "Incorrect syntax near 'ObjectName'" (918039)
The information in this article applies to:
- Microsoft SQL Server 2005 Standard Edition
- Microsoft SQL Server 2005 Developer Edition
- Microsoft SQL Server 2005 Enterprise Edition
- Microsoft SQL Server 2005 Express Edition
- Microsoft SQL Server 2005 Workgroup
Bug #: 404124 (SQLBUDT)
SYMPTOMSConsider the following scenario. In Microsoft SQL Server 2005, you use the correct syntax of the CREATE TYPE statement to create a common language runtime (CLR) user-defined type in a database. The compatibility level of the database is set to 80. In this scenario, you receive the following error message: Server: Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'ObjectName'.
However, you receive the expected error message if you do the following: - You use the CREATE PROCEDURE statement or the CREATE FUNCTION statement.
- You create a CLR stored procedure or a CLR function.
The error message contains the following text: Server: Msg 325, Level 15, State 1, Procedure ObjectName, Line 4
Incorrect syntax near 'external'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the stored procedure sp_dbcmptlevel.
RESOLUTIONTo resolve this problem, you must set the compatibility level of the database to 90 when you try to create CLR objects on the database. To do this, run the following statement for the database: exec sp_dbcmptlevel 'DatabaseName', 90 Note If you migrate a database from Microsoft SQL Server 2000 to SQL Server 2005, you must make sure that you set the compatibility level to 90 before you create a CLR object in the database. STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Minor | Last Reviewed: | 5/9/2006 |
---|
Keywords: | kbtshoot kbprb kbsql2005clr kbExpertiseAdvanced KB918039 kbAudDeveloper kbAudITPRO |
---|
|