Message 8115, Level 16, Status 5-Arithmetic overflow error when converting Numeric to data type scan

Asked

Viewed 312 times

0

I can’t find what’s wrong with these conversions :

INSERT INTO @RESULTADO
                SELECT @DATA_REF                             as data_ref, 
                       @EMPRESA                              as empresa, 
                       @LOCAL                                as local_loja,
                       Month(@DATA_REF)                      as mes, 
                       Year(@DATA_REF)                       as ano, 
                       Sum(ISNULL(VE.EXTSLDPOS * VE.PRECO1, 0))  as saldo, 
                       Cast(Month(@DATA_REF) AS VARCHAR(2)) + '/' 
                       + Cast(Year(@DATA_REF) AS VARCHAR(4)) AS ANO_MES,

-- AQUI DAR O ERRO.


DECLARE @RESULTADO TABLE 
  ( 
     data_ref       DATETIME, 
     empresa        INT, 
     mes            INT, 
     ano            INT, 
     saldo          DECIMAL(15, 7), 
     ANO_MES        VARCHAR(7),
     local_loja     INT,
     DESCRICAO      VARCHAR(30) 
  )  
  • apparently the error is self explained: convert numeric to varchar

  • But like, I cast the month and year to sweep,

  • pq does not use date formatting instead of concatenating ?! which bd is using ?

  • That’s sql Server, right?

  • yes,sqlserver14

  • @Arturbruno managed to solve his problem?

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.