Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SET ANSI_WARNINGS OFF

Posted on 2006-06-22
5
Medium Priority
?
1,094 Views
Last Modified: 2012-05-05
I keep getting this error.

String or binary data would be truncated

I've done numerous checks to make sure the fields are large enough for the data, and they are.  Somethings just not working.  I don't care if the data is truncated.  I read a post aobut using the SET ANSI_WARNINGS OFF but I can't seem to get that to work.  I am using ASP.NET with an SqlDataAdapter to add 55,000 rows to a newly created table from a "|" delimited text file.  

I use EMS SQL manager, and I tried executing a script on the database:

SET ANSI_WARNINGS OFF
GO

and I still get the "...would be truncated error"

How do I set it so that it truncates it? I have 75 columns so there has to be an easier way then going through and truncating each objRow("fieldName") = myData(0) within the code.

Please help,

thanks

Chris
0
Comment
Question by:seefresh
[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
  • 2
  • 2
5 Comments
 
LVL 25

Expert Comment

by:jrb1
ID: 16961688
Are you running a stored procedure?  Is that command in your SP?
0
 

Author Comment

by:seefresh
ID: 16961732
No its not, I'm not too sure about stored procedures.  You put a stored procedure on a specific table right? Would I have to make a "truncate" type command for each field if I used a stored procedure?
0
 
LVL 25

Accepted Solution

by:
jrb1 earned 1500 total points
ID: 16962413
I don't think so.  I believe that if you were using a stored procedure, and the stored procedure first did the "SET ANSI_WARNINGS OFF", you wouldn't get the error returned.
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 16963587
this more probably indicates thta you have a malformed row in the input....
have you confirmed that the data is being processed correctly and that all rows have 75 columns presented..

which database system are we dealing with...?
0
 

Author Comment

by:seefresh
ID: 16964253
mssql database, yes, if a row doesn't have 75 columns I skip it.  I check after I split the row:

newRow = Split(currentLine, "|")
If newRow.Length = 75 Then

 ...add to db

End If

Do I need to re-write my entire data input to work with a stored procedure?
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

660 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