-2

I have string that contains a "/".

How can insert that string into database table column?

When I tried to insert record using simple query like :

insert into XYZ 
values (2567, '364722988', 'ABC', 'IL/ITO-CLVB DEPT APO AE')

I get an error:

Msg 8152, Level 16, State 4, Line 14
String or binary data would be truncated.

When I remove "/" from my query it will allow me to enter data.

Any suggestion would be appreciated.

Edit:

I already checked column length, it is not an issue here.

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
Parth Ruparelia
  • 237
  • 4
  • 14

1 Answers1

4

String or binary data truncated error usually comes if table column length is less than data being inserted.

Check length of your 4th column in table XYZ where you are inserting value 'IL/ITO-CLVB DEPT APO AE'

SSD
  • 1,277
  • 1
  • 11
  • 20
  • this sql fiddle shows no issue inserting that string which leads me to venture that Surjit is correct: http://sqlfiddle.com/#!18/12ce1/1 – misterManager Feb 19 '18 at 14:41