Home > database >  Strange! Insert a over field length record, database has no error!
Strange! Insert a over field length record, database has no error!

Time:01-13

Version: SQL Server 2016

- create a database (field size of 3)
The CREATE TABLE [dbo] [test] ([a] nvarchar (3))

- insert string length more than 3, error,
INSERT INTO test VALUES (' 1111111111 ');
- [Err] 22001 - [SQL Server] String or binary data whenever truncated.

- insert string length more than 3 (insert success, no error!!! )
INSERT INTO test VALUES (' 1 ');

- see the database record is' 1 ', find the length more than 3 Spaces truncated,

Does anyone know what is this mechanism? The official document didn't find,
  • Related