DECLARE
@k numeric,
@acc numeric
SET
@k = 651393561522 ,
@acc = 1231234560
WHILE (@k < 651393563552)
BEGIN
SET @k = @k 1 ,
@acc = @acc 1
insert into recipients (id, client_id, inn, name, bic, bill, version)
VALUES(@k, 1, @acc, 'clientid' cast(@k as varchar), 300335, 'bill' cast(@acc as varchar), 1)
END
Have such errors:
[42000][257] Implicit conversion from datatype 'NUMERIC' to 'VARCHAR' >is not allowed. Use the CONVERT function to run this query.
[42000][257] Implicit conversion from datatype 'INT' to 'VARCHAR' is >not allowed. Use the CONVERT function to run this query.
CodePudding user response:
The error messages mention implicit conversion errors so this would tend to rule out the explicit conversions being performed by the cast()
calls.
This leaves us with datatype mismatch issues for the other columns/values; OP will want to doublecheck the datatypes of the recipients
columns:
the 1st error message mentions
numeric to varchar
and since the only numeric values are@k
and@acc
, I'm guessing either theid
orinn
column is defined asvarchar
the 2nd error message mentions
integer to varchar
and since Sybase (ASE) treats1
and300335
as integers, I'm guessing either theclient_id
,bill
orversion
column is defined asvarchar