解决方案: |
--删除wa_gzdata中字符字段的非法字符,目前只包含制表符号7,回车符号13,换行符号10,可以手工添加,适合所有SQL2000版本 --writed by fq
DECLARE curFld CURSOR READ_ONLY
FOR
SELECT [iGZItem_id] ,[cSetGZItemName]
FROM [WA_GZtblset]
where [iSetGZItemStyle]=1
DECLARE @FldId varchar(40),@FldList varchar(500),@UptList as varchar(500),@FldName varchar(40)
OPEN curFld
FETCH NEXT FROM curFld INTO @FldId,@FldName
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
set @UptList='update wa_gzdata set @1=replace(@1,@2,'+''''+''''+') where charindex(@2,@1)>0'
set @UptList=replace(@UptList,'@1','F_'+rtrim(@FldId))
set @FldList=replace(@UptList,'@2','char(7)')
exec(@FldList) if @@rowcount>0 print '工资项目:'+@FldName+'有制表附符号'
set @FldList=replace(@UptList,'@2','char(10)')
exec(@FldList) if @@rowcount>0 print '工资项目:'+@FldName+ '有换行符号'
set @FldList=replace(@UptList,'@2','char(13)')
exec(@FldList) if @@rowcount>0
print '工资项目:'+@FldName+ '有回车符号'
END
FETCH NEXT FROM curFld INTO @FldId,@FldName
END
CLOSE curFld
DEALLOCATE curFld |