Solved

Truncate data on insert with c#, sql sever

Posted on 2013-06-25
1
639 Views
Last Modified: 2013-06-26
I have an asp.net form (c# code behind). The form allows users to insert and edit records. Once in a while a user will put in more data into a field than it can handle. This cause the truncated data error. What I would like to do is accept as much as possible from the field and insert that, truncating the rest of the data. Is there a way to do this? Either from the stored procedure or the c# code?
0
Comment
Question by:dodgerfan
1 Comment
 
LVL 20

Accepted Solution

by:
dsacker earned 500 total points
ID: 39276264
In the stored procedure, before where you update your tables, add:

SET ANSI_WARNINGS OFF

No more truncation error messages.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

13 Experts available now in Live!

Get 1:1 Help Now