Truncate data on insert with c#, sql sever

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?
dodgerfanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
dsackerConnect With a Mentor Contract ERP Admin/ConsultantCommented:
In the stored procedure, before where you update your tables, add:

SET ANSI_WARNINGS OFF

No more truncation error messages.
0
All Courses

From novice to tech pro — start learning today.