Hallo,
I'm trying to populate a column of a table by using the a
formula that calls the following function where code_racc
is a value of another column in the same table.
1.If I execute this function from the Query yzer i
donot get any problem when i do insert in the formula the
code dbo.[VCAMPO_DARIO] (code_racc) I get an error in the
validation of the formula.
2. If i do insert in the formula the code dbo.
[VCAMPO_DARIO] (code_racc) i do not get an error only if
I substitute
SET STR_OBBL=CAST(dbo.code_racc_12(CODE_RACC) AS CHAR
(12))
with
SET STR_OBBL='9'+CODE_RACC



CREATE FUNCTION [VCAMPO_DARIO]
(
CODE_RACC CHAR(11)
)

RETURNS CHAR(18)

AS
BEGIN

DECLARE INT_OBBL BIGINT
DECLARE OBBL CHAR(16)
DECLARE RESTO BIGINT
DECLARE STR_OBBL CHAR(12)

SET STR_OBBL=CAST(dbo.code_racc_12(CODE_RACC) AS CHAR
(12))
--SET STR_OBBL='9'+CODE_RACC

SET OBBL = TE('0',16-LEN(RTRIM(STR_OBBL))) +
RTRIM(STR_OBBL)
SET INT_OBBL=abs(CONVERT(BIGINT,OBBL))
SET RESTO=INT_OBBL%93

RETURN OBBL + TE('0',2-LEN(RTRIM(CAST(RESTO AS
VARCHAR(2))))) + RTRIM(CAST(RESTO AS VARCHAR(2)))
END


Am I doing something wrong?