SQL Update error: spaces truncate strings

192 views Asked by At

I'm having a problem with sql.

When I try updating like this:

UPDATE Event SET name = 'bla bla bla' WHERE id = 2

It gives me this error:

String or binary data would be truncated. The statement has been terminated.

However, when I try updating with one space less, like this:

UPDATE Event SET name = 'bla bla' WHERE id = 2

It works fine. How come? Any inputs on how to go around this error would be appreciated.

1

There are 1 answers

1
Gordon Linoff On BEST ANSWER

This has nothing to do with the space. The longer string is too long for name.

Look at the definition of name. You'll see that 'bla bla bla' is too long for it. But 'bla bla' fits.