[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL 2008 INSERT STATEMENTS

Posted on 2010-09-16
9
Medium Priority
?
436 Views
Last Modified: 2012-05-10
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.?
0
Comment
Question by:TAMSCODAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 33697509
how long are your character fields declared? you seem to try so store a value longer then the field max size
0
 
LVL 4

Expert Comment

by:timexist
ID: 33697586
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
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 33697600
HOw do i disable the option preventing to save changes to my table. I was trying to change the size
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 4

Expert Comment

by:timexist
ID: 33697606
you have to close the openning table, then you can save it.
0
 
LVL 3

Expert Comment

by:xiong8086
ID: 33697885
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
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 33699076
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
 
LVL 3

Accepted Solution

by:
jvejskrab earned 2000 total points
ID: 33701026

tools -> options -> designers -> table and database designers -> prevent saving changes.......
0
 
LVL 4

Expert Comment

by:parthmalhan
ID: 33710979
Please provide Table Definition/structure.
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34119902
Dear TAMSCODAN,

Any update ?

Raj
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question