EXEC() is an inferior solution to sp_executesql and the CLR. The reason for this is that since EXEC() does not take parameters, you have to build a query string with parameter values interpolated.
You are on SQL 7 or SQL 2000, and the query string could exceed 4000 characters. As you can say
EXEC(@sql1 + @sql2 + @sql3 ...)
there is no practical limit to the length of the query string with EXEC(). On SQL 2005 you can use nvarchar(MAX), with sp_executesql, so this issue does not exist there.
Friday, January 18, 2008
EXEC in SQL Server
Labels:
SQL Server,
T-SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment