If the collocation of the database is in English and the field is a varchar type, inserting Chinese data into the table will cause garbled characters.
Workaround:
Method 1. Modify the varchar to nvarchar type and add n before inserting the data, for example: INSERT INTO table_name (a) VALUES (N ' Chinese ')
Method 2. If you do not modify the field type or varchar, you need to modify the collocation of the database to Chinese, reference
---------------------------------------------------------------------------------------------------------
Also, when you are building a table, you specify the language of a field,
Method COLLATE Chinese_prc_cs_as_ws
Example:
CREATE TABLE Test
(
A varchar (255) COLLATE Chinese_prc_cs_as_ws NULL,
b varchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
)
Test:
Insert test values (' Chinese ', ' Chinese ')
After inserting the field A is Chinese, B is??
---------------------------------------------------------------------------------------------------------
If you use a stored procedure to insert data, you need to change the corresponding parameter type to nvarchar.
Example:
Create PROCEDURE [dbo]. [Export_create]
@C_HM nvarchar (128)
As
INSERT into Export
([C_CCH])
Values
(@C_HM)
In the table, C_CCH is a varchar type.
SQL Server inserts garbled language