I’m upsizing an existing MS Access backend to SQL Server 2008 and, because we want to use SQL Server Merge replication, I’ll have to change all current primary keys (currently standard autoincrement integers) to GUID.
So here are the questions:
- Any recommendation on doing the change of primary keys from integer to GUID?
- Any recommendation on using and manipulating the GUID from code from within Access clients?
- Which SQL Server GUID type should I use?
Chris is right when saying that (1) you do not need GUIDS for merge replication and (2) there is only one GUID type, but you have to know that:
rowguid. Of course, if you already have such a GUID/newSequentialId in each table, SQL will make use of it. BUt I do not advise you to ‘mix’ replication GUIDs with PK GUIDs: you could declare all your primary keys of the GUID type as ‘newSequentialIds’, but (a) you would then loose the possibility to generate GUID values on the client’s side – see infra – and (b) your PKs will then be ‘predictable’, and this idea makes me feel uncomfortable…Concerning the change from integers to GUIDS, I advise you to write a step-by-step module that will:
Take your time to write this code. You will use it many times before having it properly working. You should make profit of the DAO object, tabledefs, indexes, and so on. Keep in mind that you must allways be able to go back to the starting point, so don’t forget the initial backup process.
What about manipulating GUIDs from VBA? There are a few things to know about that: