数据库名: UFDATA_001_2010
D:\U8SOFT\Admin\SQLFILE8900\Main\Ufdata\Structure\data_prv_ed_mix_nl.sql
错误信息:
-2147217900
列名 'cOMCostDifCode' 无效。
执行如下语句时出错:
CREATE FUNCTION dbo.GetInvCode(@invCCode nvarchar(12),@cType char(1),@Item varchar(50),@cInvType nvarchar(2))
RETURNS nvarchar(12)
AS
BEGIN
if isnull(@invCCode,'')=''
RETURN('')
declare @cInvCode as nvarchar(20)
declare @cInvCCodeP as nvarchar(12)
declare @CodeLen as tinyint
declare @CodeLenP as tinyint --前级编码长度
declare @CodeLenC as tinyint --当前编码长度
declare @i as integer
declare @j as integer
select @i=len(CodingRule) from GradeDef where iSerial=3
set @j=1
set @CodeLen=0
set @CodeLenP=0
set @CodeLenC=len(@invCCode)
while @j<=@i
begin
set @CodeLenP=@CodeLen
select @CodeLen=@CodeLen+convert(tinyint,substring(CodingRule,@j,1)) from GradeDef where iSerial=3
if @CodeLen=@CodeLenC
break
set @j=@j+1
end
select @cInvCode=case when @Item='cInvCode' then cInvCode
when @Item='cInvPrcDifCode' then cInvPrcDifCode
when @Item='cInvQanDifCode' then cInvQanDifCode
when @Item='cInvVerDifCode' then cInvVerDifCode
when @Item='cLbrCode' then cLbrCode
when @Item='cLbrPrcDifCode' then cLbrPrcDifCode
when @Item='cLbrQanDifCode' then cLbrQanDifCode
when @Item='cLbrVerDifCode' then cLbrVerDifCode
when @Item='fSemiLaborDif' then fSemiLaborDif
when @Item='cManFixCode' then cManFixCode
when @Item='cManFixPrcDifCode' then cManFixPrcDifCode
when @Item='cManFixQanDifCode' then cManFixQanDifCode
when @Item='cManFixVerDifCode' then cManFixVerDifCode
when @Item='fSemiManuFixDif' then fSemiManuFixDif
when @Item='cManVarCode' then cManVarCode
when @Item='cManVarPrcDifCode' then cManVarPrcDifCode
when @Item='cManVarQanDifCode' then cManVarQanDifCode
when @Item='cManVarVerDifCode' then cManVarVerDifCode
when @Item='fSemiManuVarDif' then fSemiManuVarDif
when @Item='cOMCostCode' then cOMCostCode
when @Item='cOMCostVerDifCode' then cOMCostVerDifCode
when @Item='cOMCostDifCode' then cOMCostDifCode
when @Item='fSemiOmCostDif' then fSemiOmCostDif
end
from pl_CO_InvCCode where cInvCCode=@InvCCode and cType=@cType and isnull(cInvType,'0')=@cInvType
if not @cInvCode is null
RETURN(@cInvCode)
else
begin
declare @L as nvarchar(12)
select @cInvCCodeP=cInvCCode from inventoryclass where cInvCCode=substring(@invCCode,1,@CodeLenP)
if @CodeLenP<>0
begin
set @L=dbo.GetInvCode(@cInvCCodeP,@cType,@Item,@cInvType)
RETURN(@L)
end
else
RETURN(NULL)
end
RETURN(NULL)
END