0

I need to synchronize an SQL Server database to Oracle through an Oracle Transparent Gateway. The synchronization is performed in batches, so I need to get the next set of data from the point where I left off.

The problem I'm having is that the only field I have in the source, to help me, is a GUID. If it were a number I could just order by it, keep the last one processed and restart the process by getting the records which are > my recorded number. This won't work with a GUID.

Any ideas?

4

2 回答 2

0

显然这有效:

SELECT * FROM v_source_supplier_prices
WHERE HEXTORAW(REPLACE(ID,'-','')) > HEXTORAW(REPLACE('0022F17B-24B3-43EC-8D81-FFD3149950E7','-','')) 
ORDER BY HEXTORAW(REPLACE(ID,'-',''))

ID 是源系统上的 GUID 字段。

不知道要多少钱...

于 2009-03-03T11:21:47.360 回答
0

您也可以对字符串(varchar、varchar2)进行排序,那么为什么需要一个数字呢?将 guid 转换为字符串不是更快吗?也许它们已经存储为字符串?

于 2009-03-07T11:41:42.210 回答