String or binary data will be ignored

I am trying to execute the following SQL query using MS SQL Server Management Studio express.

Insert INTO SU_PRO_RE ( d_id, fis_year, last_dp, budget_amt) VALUES ( 'A','2011', 0, 205000.00); 

Everything looks right to me, but every time I try to execute it, it has the following:

 String or binary data would be truncated. The statement has been terminated. (0 row(s) affected) 

The tables are in the following order:

 d_id = char(1) *PK* fis_year = char(2) *PK* last_dp = smallint budget_amt = money 

I'm not sure what I'm doing wrong, but I'm sure I'm just watching something very obvious, so any help would be great! :)

Thanks David

+4
source share
2 answers

fis_year defined as char(2) , but you are trying to insert the value 4 of the character '2011'.

+9
source

Well, the fis_year field fis_year defined as CHAR(2) , and you are trying to insert a value of 4 charachters in length.

+2
source

Source: https://habr.com/ru/post/1340676/


All Articles