Question : UPDATE OPENQUERY (LINKEDSERVER, 'SELECT...) SET FIELD = #

After running the following OpenQuery...

UPDATE OPENQUERY(LINKEDSERVER, 'SELECT START_ORDER_NO FROM "OECTLFIL" WHERE "FILE_KEY" = 1')
SET START_ORDER_NO = 0

----The START_ORDER_NO field contains a 48

SET START_ORDER_NO = 1~9

----The START_ORDER_NO field contains 49~57 respectively.

SET START_ORDER_NO = 10
---The START_ORDER_NO field contains 12337
SET START_ORDER_NO = 11
---The START_ORDER_NO field contains 12593
SET START_ORDER_NO = 12
---The START_ORDER_NO field contains 12849

incrementing by 256 as I increase the value I write...

The LinkedServer is Pervasive SQL 2000i using 'OLE DB Provider for ODBC'

The START_ORDER_NO field is a Numeric(8,0)

I'm thinking some kind of Unicode, or translation or code page issue, but I haven't had any luck yet.

I'm not sure how difficult this is, I don't think I'm a neophyte but I'm feeling like one...

Answer : UPDATE OPENQUERY (LINKEDSERVER, 'SELECT...) SET FIELD = #

You can't just subtract the ascii value of the character zero because when the value is two bytes there's an addition of 256 times a number, as well.

In any case, even if you could make that sort of work, I wouldn't trust it.
Random Solutions  
 
programming4us programming4us