How can i execute a long string sql( whose length more then 10000)?
by Ari Weil
If you use SQL Server 2005, this system procedure can accept up to a 2GB unicode string (nvarchar(max)). Also, when you use sp_executeSQL, you might see a performance benefit over the EXECUTE command because the actual text of the statement you’re executing won’t change between executions; this means the query optimizer has a higher likelihood of matching the statement in subsequent executions with the first execution plan generated.