TTC*_*TCG 1 t-sql sql-server sql-server-2008 sp-executesql
我想执行大约10,000个字符的动态SQL语句.
当我使用sp_executesql如下:
DECLARE @stmt varchar(MAX)
SET @stmt = 'xxxxxxxx.................' which is about 10,000 characters
EXEC sp_executesql @stmt
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
The character string that starts with ' select t1.e_reference xxxxxxxxxxx' is too long. Maximum length is 8000.
Run Code Online (Sandbox Code Playgroud)
据我所知,我们可以使用sp_executesql来执行很长的语句,不是吗?
我使用的是SQL Server 2008企业版,64位.
我怎样才能做到这一点?谢谢.
根据您在帖子中的回复,您正在使用linked server
.8000 char
限制不是由sp_executesql提出的,而是由你可能在变量@stmt中使用的OPENQUERY提出的.
MSDN说这是OPENQUERY的论点:
'
query
'查询字符串是否在链接服务器中执行.最大长度string
为8 KB.
http://msdn.microsoft.com/en-us/library/ms188427.aspx
要绕过这个,你可以使用
execute (@query) at oracle_linked_server
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13306 次 |
最近记录: |