Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

A conversão falhou ao converter o valor varchar 'none' para o tipo de dados int


Se suas tabelas realmente consistem em None e NA, tente isto:
ALTER PROCEDURE spvec
AS
SELECT Row_number() OVER (ORDER BY (SELECT 1)) AS 'RNumber'
    ,vf.*
FROM LOGIN ld
    ,vehicle vf
WHERE (ld.fid = cast(vf.fid as varchar(max)))
    AND cast(ld.id as varchar(2)) <> 'NA'
    AND cast(vf.CustID as varchar(4)) <> 'None'
    AND cast(vf.Simo as varchar(4)) <> 'None'
ORDER BY Row_number() OVER (ORDER BY (SELECT 1))