Solved

Truncate data on insert with c#, sql sever

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

12 Experts available now in Live!

Get 1:1 Help Now