You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using BulkCopy to insert Chinese data into the table in batches can be successfully stored in the database,however, the Chinese characters stored in the database are garbled. For example, the string "你好" becomes "浣犲ソ " in the database.
The type of the field is varchar, and according to requirements, nvarchar cannot be used instead.
Please tell me how to solve this requirement, thank you.
stmt, err := txn.Prepare(mssql.CopyIn("t_batch_update", mssql.BulkOptions{}, "id", "name"))
if err != nil {
fmt.Println(err)
return
}
for i := 0; i < 10; i++ {
_, err = stmt.Exec(i, "你好")
if err != nil {
fmt.Println(err)
return
}
}
result, err := stmt.Exec()
if err != nil {
fmt.Println(err)
return
}
err = stmt.Close()
if err != nil {
fmt.Println(err)
return
}
err = txn.Commit()
if err != nil {
fmt.Println(err)
return
}
The text was updated successfully, but these errors were encountered:
Using BulkCopy to insert Chinese data into the table in batches can be successfully stored in the database,however, the Chinese characters stored in the database are garbled. For example, the string "你好" becomes "浣犲ソ " in the database.
The type of the field is varchar, and according to requirements, nvarchar cannot be used instead.
Please tell me how to solve this requirement, thank you.
The text was updated successfully, but these errors were encountered: