C
citybug_ch
Unregistered / Unconfirmed
GUEST, unregistred user!
alter procedure p_ChargeIOBasic @ItemObjectID varchar(10)
as
begin
--定义变量省略
--选择被修改的办件基本信息
Declare C_UpdateIOBasic Cursor for
select ItemObjectID from IOBasic where ItemObjectID=@ItemObjectID
open C_UpdateIOBasic
Fetch Next from C_UpdateIOBasic into @ItemObjectID
while (@@FETCH_STATUS=0)
begin
--办件详细信息
print @ItemObjectID
select @ItemObjectID=ItemObjectID,@EnterPriseID=EnterPriseID,@IOUnionID=IOUnionID,
@ItemObjectNo=ItemObjectNo,@ItemType=ItemType,@Mobilephone=Mobilephone,
@LoginDate=LoginDate,@P2=TextPtr(ApplyDoc),@Remark=Cast(Remark as nvarchar(4000)),@ItemClassID=ItemClassID,
@ItemStatus=ItemState,@RemainDays=RemainDays from IOBasic where ItemObjectID=@ItemObjectID
--查看上报的WSSP_MAIN表中是否有这个办件
select @WorkFlowInstance_guid=WorkFlowInstance_guid from Wssp_main where substring(ItemObjectID,1,10)=@ItemObjectID
--如果有
print @WorkFlowInstance_guid
if not (@WorkFlowInstance_guid=null)
begin
print 'c'
--取的WorkFlow_guid
select @WorkFlow_guid=WorkFlow_guid from wssp_main where WorkFlowInstance_guid=@WorkFlowInstance_guid
--取的自定义表名称
select @TableName=title_tablename from OFFICE_Workflowdefine where WorkFlow_GUID=@WorkFlow_guid
--取得企业相关信息
select @EnterpriseName=EnterpriseName,
@EnterpriseCode=EnterpriseCode,
@principal=principal,
@Enterprisephone=phone,
@PostCode=PostCode,
@EnterpriseAddress=EnterpriseAddress
from IOEnterprise where EnterpriseID=@EnterpriseID
--取得办件类型
select @ItemTypeName=CodeDescription from AppCodeItem where OuterCodeID=@ItemType and CodeTableName='ItemClassType'
--取得项目名称
select @ItemClassName=ItemClassName from ICDef where ItemClassID=@ItemClassID
--取得办件状态
select @ItemStatusDes=CodeDescription from AppCodeItem where OuterCodeID=@ItemStatus and CodeTableName='ItemState'
--拼HTML字符串
print 'd'
set @HTML='<html> '
set @HTML=@HTML + '<head> '
set @HTML=@HTML + '<meta http-equiv="Content-Language" content="zh-cn">'
set @HTML=@HTML + '<meta http-equiv="Content-Type" content="text/html; charset=gb2312">'
set @HTML=@HTML + '<meta name="GENERATOR" content="Microsoft FrontPage 4.0">'
set @HTML=@HTML + '<meta name="ProgId" content="FrontPage.Editor.Document">'
set @HTML=@HTML + '<title>项目办件登记</title>'
set @HTML=@HTML + '</head>'
set @HTML=@HTML + '<body bgcolor="#168DFA">'
(部分省略)
set @HTML=@HTML + '</body>'
set @HTML=@HTML + '</html>'
print 'e'
--修改wssp_main中的数据
Update Wssp_Main set
ItemObjectID=@ItemObjectID + '[' + @EnterpriseName + ']',
ItemObjectNo=@ItemObjectID,
ItemTitle=@EnterpriseName,
HtmlIn=@Html
where WorkFlowInstance_guid=@WorkFlowInstance_guid
print 'f'
UpdateText Wssp_main.HtmlIn2 @p2 0 Null
print 'g'
--修改自定义表中的数据
set @sql='Update ' + @TableName + ' set T_ItemObjectID=' + @ItemObjectID + '[' + @EnterpriseName + ']' + ' where WorkFlowInstance_GUID=' + @WorkFlowInstance_Guid
exec sp_executesql @sql
Fetch Next from C_UpdateIOBasic into @ItemObjectID
end
end
close C_ResultItem
deallocate C_ResultItem
end;
运行这个存储过程,提示:
服务器: 消息 7123,级别 16,状态 1,过程 p_ChargeIOBasic,行 166
text、ntext 或 image 指针值 0xFAFF281304000000FF4A000001000F00 无效。
语句已终止。
我写的哪里出现了问题?怎么解决?
as
begin
--定义变量省略
--选择被修改的办件基本信息
Declare C_UpdateIOBasic Cursor for
select ItemObjectID from IOBasic where ItemObjectID=@ItemObjectID
open C_UpdateIOBasic
Fetch Next from C_UpdateIOBasic into @ItemObjectID
while (@@FETCH_STATUS=0)
begin
--办件详细信息
print @ItemObjectID
select @ItemObjectID=ItemObjectID,@EnterPriseID=EnterPriseID,@IOUnionID=IOUnionID,
@ItemObjectNo=ItemObjectNo,@ItemType=ItemType,@Mobilephone=Mobilephone,
@LoginDate=LoginDate,@P2=TextPtr(ApplyDoc),@Remark=Cast(Remark as nvarchar(4000)),@ItemClassID=ItemClassID,
@ItemStatus=ItemState,@RemainDays=RemainDays from IOBasic where ItemObjectID=@ItemObjectID
--查看上报的WSSP_MAIN表中是否有这个办件
select @WorkFlowInstance_guid=WorkFlowInstance_guid from Wssp_main where substring(ItemObjectID,1,10)=@ItemObjectID
--如果有
print @WorkFlowInstance_guid
if not (@WorkFlowInstance_guid=null)
begin
print 'c'
--取的WorkFlow_guid
select @WorkFlow_guid=WorkFlow_guid from wssp_main where WorkFlowInstance_guid=@WorkFlowInstance_guid
--取的自定义表名称
select @TableName=title_tablename from OFFICE_Workflowdefine where WorkFlow_GUID=@WorkFlow_guid
--取得企业相关信息
select @EnterpriseName=EnterpriseName,
@EnterpriseCode=EnterpriseCode,
@principal=principal,
@Enterprisephone=phone,
@PostCode=PostCode,
@EnterpriseAddress=EnterpriseAddress
from IOEnterprise where EnterpriseID=@EnterpriseID
--取得办件类型
select @ItemTypeName=CodeDescription from AppCodeItem where OuterCodeID=@ItemType and CodeTableName='ItemClassType'
--取得项目名称
select @ItemClassName=ItemClassName from ICDef where ItemClassID=@ItemClassID
--取得办件状态
select @ItemStatusDes=CodeDescription from AppCodeItem where OuterCodeID=@ItemStatus and CodeTableName='ItemState'
--拼HTML字符串
print 'd'
set @HTML='<html> '
set @HTML=@HTML + '<head> '
set @HTML=@HTML + '<meta http-equiv="Content-Language" content="zh-cn">'
set @HTML=@HTML + '<meta http-equiv="Content-Type" content="text/html; charset=gb2312">'
set @HTML=@HTML + '<meta name="GENERATOR" content="Microsoft FrontPage 4.0">'
set @HTML=@HTML + '<meta name="ProgId" content="FrontPage.Editor.Document">'
set @HTML=@HTML + '<title>项目办件登记</title>'
set @HTML=@HTML + '</head>'
set @HTML=@HTML + '<body bgcolor="#168DFA">'
(部分省略)
set @HTML=@HTML + '</body>'
set @HTML=@HTML + '</html>'
print 'e'
--修改wssp_main中的数据
Update Wssp_Main set
ItemObjectID=@ItemObjectID + '[' + @EnterpriseName + ']',
ItemObjectNo=@ItemObjectID,
ItemTitle=@EnterpriseName,
HtmlIn=@Html
where WorkFlowInstance_guid=@WorkFlowInstance_guid
print 'f'
UpdateText Wssp_main.HtmlIn2 @p2 0 Null
print 'g'
--修改自定义表中的数据
set @sql='Update ' + @TableName + ' set T_ItemObjectID=' + @ItemObjectID + '[' + @EnterpriseName + ']' + ' where WorkFlowInstance_GUID=' + @WorkFlowInstance_Guid
exec sp_executesql @sql
Fetch Next from C_UpdateIOBasic into @ItemObjectID
end
end
close C_ResultItem
deallocate C_ResultItem
end;
运行这个存储过程,提示:
服务器: 消息 7123,级别 16,状态 1,过程 p_ChargeIOBasic,行 166
text、ntext 或 image 指针值 0xFAFF281304000000FF4A000001000F00 无效。
语句已终止。
我写的哪里出现了问题?怎么解决?