Solved

Truncate data on insert with c#, sql sever

Posted on 2013-06-25
1
655 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled

713 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