Timeline for "String or binary data would be truncated" error copying nvarchar(10) to char(10)
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 11, 2015 at 11:54 | vote | accept | user5664489 | ||
Dec 11, 2015 at 2:59 | history | tweeted | twitter.com/StackDBAs/status/675147761528999937 | ||
Dec 10, 2015 at 19:19 | history | edited | Solomon Rutzky |
edited tags
|
|
Dec 10, 2015 at 18:23 | answer | added | Solomon Rutzky | timeline score: 11 | |
Dec 10, 2015 at 18:07 | comment | added | Martin Smith | Any triggers or computed columns on the table? | |
Dec 10, 2015 at 17:47 | comment | added | agpoweredmg | It could have to do with character encoding. You might try converting the char(10) column to a nchar(10) column. Here are some links to BOL pages nchar and nvarchar, char and varchar | |
Dec 10, 2015 at 17:24 | comment | added | Aaron Bertrand | Can you show the actual insert statement that you're using, share the collation of the columns in both tables, and let us know if there are triggers on the destination table (perhaps the error isn't coming from the same place you think it's coming from)? How do you know for certain it's this column that has the problem? | |
Dec 10, 2015 at 16:24 | comment | added | paparazzo | A reach but you may have nvarcahr that cast to two char. Like ae. Do select where len(cast(sourcecol as varchar(20)) > 10 | |
Dec 10, 2015 at 16:15 | history | reopened |
Solomon Rutzky Paul White♦ |
||
Dec 10, 2015 at 14:54 | history | closed | Paul White♦ | Needs more focus | |
Dec 10, 2015 at 14:50 | history | edited | Paul White♦ | CC BY-SA 3.0 |
deleted 14 characters in body; edited tags; edited title
|
Dec 10, 2015 at 14:43 | comment | added | Andriy M |
Invisible characters are still characters. They still take up some space in memory, even though they may take up none on the screen. You can't squeeze them in to an nvarchar(10) value if it's already got 10 chars, to thus make the value hold more than 10. Are you sure the issue has to do with those two particular types?
|
|
Dec 10, 2015 at 14:13 | comment | added | Allan S. Hansen | Sounds very likely there are system characters ("invisible") in the data - check it with hex editor to see. | |
Dec 10, 2015 at 13:42 | review | First posts | |||
Dec 10, 2015 at 13:48 | |||||
Dec 10, 2015 at 13:39 | history | asked | user5664489 | CC BY-SA 3.0 |