B
B
Bombadile2016-07-18 06:17:57
Yii
Bombadile, 2016-07-18 06:17:57

Why isn't Cyrillic written in the MS-SQL text field?

There is a field in MS-SQL, windows-1251 encoding, text type. Through activeRecord, the value of the "address" field (Cyrillic) is added, the following query is formed:
INSERT INTO [Orders] [Address]) VALUES (0xc8ecff20d4e0ece8ebe8ff20cef2f7e5f1f2e2ee)
An error appears: "Operand type conflict: varbinary is incompatible with text". On the varchar type, everything is fine. What to do?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
B
Bombadile, 2016-07-20
@Bombadile

PDO in PHP7 has such a bug. Rolled back to php5.

A
Artyom Karetnikov, 2016-07-18
@art_karetnikov

use the correct types to store data. if the address field is only 30 characters at a glance, why do it text? The text, contrary to the name, is intended for storing a large amount of data.

A
Alexey, 2016-07-18
@k1lex

Probably not enough quotes.
But I would not use the TEXT type if I were you - it will be abandoned in new versions. Use nvarchar(max)

K
Konstantin Tsvetkov, 2016-07-18
@tsklab

The error appears: "Operand type conflict: varbinary is incompatible with text". On the varchar type, everything is fine. What to do?

Use nvarchar(max)
It makes more sense to use the varbinary(50) type, or whatever length you need.

R
Roman, 2016-07-18
@yarosroman

for normal work with Unicode use nchar and nvarchar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question