Space character problem in sqlserver database field

Defined in SQL:
char: fixed length, storing ANSI characters, insufficient to fill English half-width spaces.

nchar: fixed length, store Unicode characters, insufficient to fill English half-width spaces

varchar: Variable length, stores ANSI characters, and changes automatically according to the data length.

nvarchar: Variable length, stores Unicode characters, and changes automatically according to the data length.

Solution: It
is recommended to use varchar and nvarchar for the character primary key class in the business.
If you use char, it is best to trim in the query statement to prevent unnecessary errors in the business.

Published 13 original articles · praised 0 · visits 4643

Guess you like

Origin blog.csdn.net/qq_37869796/article/details/105426601