Character Limitation in sp_executesql
Microsoft’s SQL Server development team unlocks the key to character limitation when a reader uses a system stored procedure in a script.
Microsoft's Sql Server Development Team
October 22, 2002
1 Min Read
I notice that when I use the sp_executesql system stored procedure in a script, my script can't exceed 4000 characters. What's the reason for this character limitation?
The sp_executesql statement's @stmt parameter is a Unicode string. Therefore, given that the maximum string length in SQL Server 2000 is 8000 bytes (without using an ntext data type) and that each character in Unicode is 2 bytes, 4000 characters is the maximum that sp_executesql can accept.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like