INF: SQL Server Truncation of a DBCS StringLast reviewed: April 9, 1997Article ID: Q155723 |
The information in this article applies to:
SUMMARYIf the data entered is too long for the specified datatype, char and varchar entries are truncated. If SQL Server is installed with appropriate DBCS as default code page and when this truncation happens right in the middle of a double-byte character, the whole double-byte character will be discarded. The following scripts demonstrate this truncation. CREATE TABLE test ( col1 char (10), col1 varchar (10)) GO
/* Let D represent a double character. */ /* Let L represent the leading byte. */ /* Let T represent the trailing byte. */ /* Let S represent a single character. */ /* Let s represent space (ASCII 20). */INSERT test VALUES ("SDDDDD", "SDDDDD") GO SELECT * FROM test GO
col1 col2---------- ---------- SLTLTLTLTs SLTLTLTLT Because the truncated string is shorter than the maximum length, the char column that does not allow null value and the char variable will be padded with trailing blank while the varchar column will not store training blank.
|
Additional query words: DBCS
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |