动态SQL字符长度超过4000 使用数据类型 nvarchar(max)

您所在的位置:网站首页 oracle存储超过4000的字符 动态SQL字符长度超过4000 使用数据类型 nvarchar(max)

动态SQL字符长度超过4000 使用数据类型 nvarchar(max)

2024-07-06 10:39| 来源: 网络整理| 查看: 265

动态SQL字符长度超过4000,SQL SERVER 2005 SP_EXECUTESQL打破了这个限制。

declare @cSQLKey nvarchar(max) --查询语句 declare @cWhereKey nvarchar(max) --条件语句

。。。。。。

set @cWhereKey = N'where 1=1 ' if not ISNULL(@org ,'')='' BEGIN set @cWhereKey = @cWhereKey+ N' and PM_PurchaseOrder.org like '''+@org+ ''' ' END

。。。。。。。。

set @cSQLKey = @cSQLKey + @cWhereKey print @cSQLKey --exec @cSQLKey execute sp_executesql @cSQLKey Output -- 输入查询结果


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3