How to merge sites in Space Manager V2

Hint Ref: 020706250004
Hint Date: 25/06/2007

Hint Details:

I have done two tests of merging a V2 database into itself thus:


(all the files you need are in L:\SM4WIN\SQL_Scripts\Merging V2 Databases)

1. Make sure the source and target databases are the same version of V2.

2. Edit the file 'Run Before Merge for V2.txt' and set the 'PIN' to a unique two letters

3. In an Interactive SQL window to the SOURCE, EXECUTE 'Run Before Merge for V2.txt'

4. If using SpaceMerge.exe dated 08/12/2005 then, in an Interactive SQL window to both the source and target, execute:

create table iqaccashbook (dummy char(1));

5. Run SpaceMerge.exe and continue to 6. if successful.

6. Edit the file 'Run After Merge for V2.txt' and set the 'OLDPIN' to the unique two letters set in 2. above.

7. In an Interactive SQL window to the TARGET, EXECUTE 'Run After Merge for V2.txt'

8. Run the v2 Spaceman.exe identified in 1. above and place a '!' in the database name: tar!get, the database should update.

9. Check the data carefully, and keep a security copy of the SOURCE database.


If you are merging DOS converted sights IMMEDIATELY after the DOS to windows conversion, you should not need to run the 
before or after merge scripts. However, you MUST add a new Bank Account nominal code for the merged in site.

go to 'Settings/Accounts/Accounts and double click the CASH line for the merged in site. Add new Account Nominal Code info.

If the target database is smaller than the source then the lastdocumentnumber in iqacparams may need reset. Determine the maximum documentid number issued:

select max(substr(documentid, 3, 20)) from iqacdocument

Now convert this into a standard number as follows:

Each character is a multiplier i.e. b is the second letter in the alphabet but is preceeded by 10 numerals, (0-9) thus it is 12x, C is 13x, d is 14x, etc.

The first character from the left determines the number of 1's so if it is an e their are 15x1=15
The second characted the number of 36's so if it is a 9 then 9x36=324
The third character the number of 1296'1 so if it is a z then 36x1296=46656
The fourth character the number of 46656's, etc:

1 36 (36x36) (36x36x36) (36x36x36x36) (36x36x36x36x36) etc....

Set the last document number with the following SQL to the number calculated above +1000

update iqacparams set lastdocumentnumber=xxxxx

Alternatively run XML job L:\Job Runner\Update IqacParams LastDocumentNumber After Merge.XML