Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 918039 - Last Review: May 9, 2006 - Revision: 1.2
Error message when you use the correct syntax of the CREATE TYPE statement in SQL Server 2005: "Incorrect syntax near 'ObjectName'"
Bug #: 404124 (SQLBUDT)
Consider 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.
To 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.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
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 Edition
| kbtshoot kbprb kbsql2005clr kbexpertiseadvanced KB918039 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate