Solved

nvarchar(max)

Posted on 2008-10-24
6
1,165 Views
Last Modified: 2012-05-05
i have a column that i changed to nvarchar(255) to nvarchar(max)

now when I update the data something small like '123'
I get error

no row was updated
the data in row 1 was not committed
Error source: .Net  SqlClient data Provider
Error Message: String or binary data would be truncated
The statement has been terminated

123--is only 3 characters.  I changed it to nvarchar(max), why am i getting this error?
0
Comment
Question by:yanci1179
  • 3
6 Comments
 
LVL 8

Expert Comment

by:jorgesv13
ID: 22799898
Are you using a DataSet / Table Adapter for making the Insert?
Check the field definition of the Datatable in your table adapter.
It might have a low value for "Max Length"
0
 

Author Comment

by:yanci1179
ID: 22799917
i am doing an update on the database itself.  with an update statement and directly to the table
0
 

Author Comment

by:yanci1179
ID: 22800062
i did sp_help on the table and the length is -1 for the column that i changed to nvarchar(max)

I changed it to varchar(1000) and it shows the length correctly. I reverted back to nvarchar(max) and it shows - 1 again.
0
 

Accepted Solution

by:
yanci1179 earned 0 total points
ID: 22800236
okay i figured it out...... stupid actually.  the original table has a trigger on it and was updating the column of another table that was smaller.  once i made the other column nvarchar(max) it worked.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 22804788
Great!  Now please close the question.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

744 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

14 Experts available now in Live!

Get 1:1 Help Now