Link to home
Start Free TrialLog in
Avatar of vanroybel
vanroybel

asked on

"You tried to assign the null value to a variable that is not a variant data type" - AS400

I'm trying to add records in a table in AS400. I do an insert query and I get the error message : "You tried to assign the null value to a variable that is not a variant data type".

Here is my query :


INSERT INTO PRDORBIDTA_ORAALG ( BEDRAA, ARNRAA, AAKTAA, KAMCAA, AKTGAA, ALVNAA, VARTAA, OARTAA, ARVLAA, EVVBAA, BSEHAA, GWEHAA, EENHAA, VPEHAA, VERPAA, LKNRAA, ARGRAA, ARFMAA, BWRKAA, FCTRAA, USLWAA, EWLWAA, DTLWAA, TDLWAA )
SELECT 1 AS BEDRAA, qry_artikels_toadd_VERPAA.[Ref roy], "0" AS AAKTAA, 0 AS KAMCAA, "" AS AKTGAA, "" AS ALVNAA, "" AS VARTAA, "" AS OARTAA, qry_artikels_toadd_VERPAA.Description, "" AS EVVBAA, qry_artikels_toadd_VERPAA.Unité AS BSEHAA, 0 AS GWEHAA, qry_artikels_toadd_VERPAA.EENHAA, qry_artikels_toadd_VERPAA.Unité, Int([qry_artikels_toadd_VERPAA].[Quantité]) AS VERPAA, "" AS LKNRAA, qry_artikels_toadd_VERPAA.ARGRAA, qry_artikels_toadd_VERPAA.Famille, "*" AS BWRKAA, 1 AS FCTRAA, "FT" AS USLWAA, 1 AS EWLWAA, 110331 AS Expr1, 0 AS Expr2
FROM qry_artikels_toadd_VERPAA;


It seems this is not an AS400 message, but I don't know where it is coming from. I even tried casting the text value in integer before sending those to the number fields in the AS400. But nothing seems to make this error message go away.

I tried using this query in view, and it works fine. It only gives an error when trying to add into AS400.
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vanroybel
vanroybel

ASKER

Well It seems so easy now that you say it. For once the error message was in fact explicit. I did as you said, and now that I got no null values, it works.
Great!
Thanks for the feedback.

/gustav