Solved

SET ANSI_WARNINGS OFF

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now