SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SQL Server and T-SQL Development Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




download SQL Server 2016
download SQL Server 2014
download SQL Server 2012



Could not find stored procedure 'sp_executeSQL'.

SQL developers may experience Could not find stored procedure 'sp_executeSQL'. error when executing sp_executeSQL procedure on a SQL Server database with case sensitive collation. If the SQL command is written not exactly as the database objects created, such error will happen frequently on case sentitive collation SQL databases.

Here is the case I first time experienced the SQL error when I execute a very simple SQL command:
Msg 2812, Level 16, State 62, Line 5
Could not find stored procedure 'sp_executeSQL'.

exec sp_executeSQL N'select 1'

Could not find stored procedure sp_executeSQL

And when I check the database collation using following SQL statement, I see that the database is created with a case sensitive collation.

SELECT Convert(varchar, DatabasePropertyEx(DB_Name(),'collation'))

I can see that the database collation is configured as "Turkish_CS_AS" Turkish Case Sensitive, Accent Sensitive which is causing the SQL Engine to throw error related with not found sp_executeSQL system stored procedure.

check database collation on SQL Server using T-SQL

Fortunately, although the error is odd, the correction is simple. Just write the SQL codes for the database object names in the correct case as they are created.

For example, instead of using sp_executeSQL, code using sp_executesql which will be successfully executed.







Related SQL Resources

SQL Server Articles

SQL Server 2012

SQL Server Tools

SQL Blog

SQL Server 2008 Blog

Certification Exams Blog

Reporting Services Blog

Analysis Services Blog

MS SQL Server Forums







Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems