Solved

nvarchar(max)

Posted on 2008-10-24
6
1,169 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax error after > 11 39
Copy data to New Year 9 29
Parsing this XML works but the other one doesn't 9 26
Convert time stamp to date 2 54
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

685 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