4

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 correct 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 as set as follows:

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

I'm not sure what i am doing incorrect but i'm sure i am just over looking something very obvious so any help would be great! :)

Thanks, David

2 Answers 2

9

fis_year is defined as char(2) but you're trying to insert a 4 character value of '2011'.

Sign up to request clarification or add additional context in comments.

3 Comments

@Lamak: Great minds think alike. Not sure how that explains my mind though. :-)
Yep that was it, Joe. I knew it had to be something small like that. Guess i was just over-thinking it too much. :o) Thanks!
well, thanks for the compliment....i'm not sure if anything can explain your mind ;-)
2

Well, the field fis_year is defined as CHAR(2), and you are trying to insert a value that has 4 charachters long.

1 Comment

Thanks for your reply as well, Lamak! :o)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.