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 varcharand since the only numeric values are@kand@acc, I'm guessing either theidorinncolumn is defined asvarcharthe 2nd error message mentions
integer to varcharand since Sybase (ASE) treats1and300335as integers, I'm guessing either theclient_id,billorversioncolumn is defined asvarchar
