Solved

nvarchar(max)

Posted on 2008-10-24
6
1,171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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 we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

728 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