Link to home
Start Free TrialLog in
Avatar of seefresh
seefresh

asked on

SET ANSI_WARNINGS OFF

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
Avatar of jrb1
jrb1
Flag of United States of America image

Are you running a stored procedure?  Is that command in your SP?
Avatar of seefresh
seefresh

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of jrb1
jrb1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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...?
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?