SQL 2008 INSERT STATEMENTS

I am having an error inserting the following data in SQL

USE ITD640_GP4

INSERT INTO customerTbl (customerID,customerFname,customerLname,customerTel,customerCity,customerState,customerZip)
Values
      ('114','Alan','Smith','3235','Mobile','Alabama','36509'),
      ('115','Kevin','Gordon','1124','Gulf Shores','Alabama','36535'),
      ('116','Paul','Connell','1212','Gulf Shores','Alabama','36535'),
      ('117','James','Sampson','1235','Alexandria','Louisiana','80977'),
      ('118','George','Ruiz','7532','Alexandria','Louisiana','80977'),
      ('119','Peter','Johnson','3254','Alexandria','Louisiana','80977'),
      ('120','Ben','Simpson','3241','Alexandria','Louisiana','80977'),
      ('121','Ken','Gordon','6643','New York','New York','70011')
      
      
SELECT * FROM customerTbl

The error that I am gettiong is

Msg 8152, Level 16, State 4, Line 4
String or binary data would be truncated.
The statement has been terminated.

(2 row(s) affected)

Any clues on what i can do to fix this matter.?
LVL 3
TAMSCODANAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jvejskrabConnect With a Mentor Commented:

tools -> options -> designers -> table and database designers -> prevent saving changes.......
0
 
Éric MoreauSenior .Net ConsultantCommented:
how long are your character fields declared? you seem to try so store a value longer then the field max size
0
 
timexistCommented:
String or binary data would be truncated.
The statement has been terminated.

It means the value want to insert is larger than the max limitation of the field.
so you need to check the fields of customerTbl .

0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
TAMSCODANAuthor Commented:
HOw do i disable the option preventing to save changes to my table. I was trying to change the size
0
 
timexistCommented:
you have to close the openning table, then you can save it.
0
 
xiong8086Commented:
I think your data is larger than the allowed size set for your column by definition.

if you want to turn off the exception
you may add:

set ANSI_WARNINGS OFF
GO
....

after scripts finished
....
set ANSI_WARNINGS ON
GO

you may execute without warning, but you may lose some data as it will be truncated if beyond the size limit.
0
 
Rajkumar GsSoftware EngineerCommented:
Increase the datatype length of the column which is causing this error. Then only the data you are trying to insert into the table will get inserted successfully. If you suppress the error warning messages, you will lose those data that you are inserting.

So better to first check and find which column have less datatype length than the size of the data you are inserting. Then increase its datatype length. That's all.

Raj
0
 
parthmalhanCommented:
Please provide Table Definition/structure.
0
 
Rajkumar GsSoftware EngineerCommented:
Dear TAMSCODAN,

Any update ?

Raj
0
All Courses

From novice to tech pro — start learning today.