Solved

SET ANSI_WARNINGS OFF

Posted on 2006-06-22
5
1,086 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 500 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

Three Considerations for Containers

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read our article on Experts Exchange.

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

623 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