La alineación de la consulta SQL cambia cuando se insertan caracteres árabes

StackOverflow https://stackoverflow.com/questions/2226877

  •  19-09-2019
  •  | 
  •  

Pregunta

tengo una consulta como esta

SET QUOTED_IDENTIFIER OFF 
SET DATEFORMAT 'mdy' 

INSERT INTO TABLE1 
  (AccountID, TimeStamp, UserID, NodeID, Deleted, UserPriority,  ParentRecordID, NodeLevel, Name, NodeClass, DeviceID, DeviceType, SubTypeLevel)  
VALUES 
  (0, "10/03/2002 02:33:39", 0, 0, 0, 0, 0, 0,"XXXXXX",7000, 0, 0, 0`)

Cuando reemplazo XXXXXX con منطقة تحكم بالبداية السريعة, la consulta después de la cadena gira de derecha a izquierda así

SET QUOTED_IDENTIFIER OFF 
SET DATEFORMAT 'mdy' 

INSERT INTO TABLE1 
  (AccountID, TimeStamp, UserID, NodeID, Deleted, UserPriority,  ParentRecordID, NodeLevel, Name, NodeClass, DeviceID, DeviceType, SubTypeLevel)  
VALUES 
  (0, "10/03/2002 02:33:39", 0, 0, 0, 0, 0, 0, "منطقة تحكم بالبداية السريعة", 7000, 0, 0, 0)

Por favor dime cómo superar esto.

Estoy usando SQL Server 2000 MSDE.

¿Fue útil?

Solución 2

Este problema se resuelve cuando se añade N antes del valor nvarchar.

SET QUOTED_IDENTIFIER OFF SET DATEFORMAT 'mdy' INSERT INTO ControlTreeEx (AccountID, TimeStamp, UserID, NodeID, Deleted, UserPriority,  ParentRecordID, NodeLevel, Name, NodeClass, DeviceID, DeviceType, SubTypeLevel)  VALUES (0, "10/03/2002 02:33:39", 0, 0, 0, 0, 0, 0, N'منطقة تحكم بالبداية', 7000, 0, 0, 0)

Otros consejos

Puede resolver este caso mediante la adición de la letra N antes de cada uno de los valores introducidos (esa necesidad de conversión)

Por ejemplo:

INSERT INTO TABLE1(AccountID, TimeStamp, UserID, NodeID, Deleted, UserPriority, 
       ParentRecordID, NodeLevel, Name, NodeClass, DeviceID, DeviceType, SubTypeLevel)  
VALUES 
  (0, "10/03/2002 02:33:39", 0, 0, 0, 0, 0, 0, "منطقة تحكم بالبداية السريعة"N, 7000, 0, 0, 0) 

=>

Insert ... Into ... Values (id1,id2,..., N'Arabic word',N'Hebrew word',N'Chinese word');
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top