数据库版本:sql server 2016
--Create database
CREATE TABLE [dbo].[test] ([a] nvarchar(3))
--Insert strings longer than 3 (Success and not report an error)
SET ANSI_PADDING ON;
INSERT INTO test VALUES('1 ');
--Query table results '1 ',Its length is 3.
SET ANSI_PADDING ON;
INSERT INTO test VALUES('1111111111');
--[Err] 22001 - [SQL Server]String or binary data would be truncated.
据docs.microsoft.com称,“插入varchar列的字符值中的尾随空格不会被修剪。”
谁能告诉我为什么?谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!