Using below Query i am fetching details related to ledgers from tally. Code: <ENVELOPE><HEADER><VERSION>1</VERSION><TALLYREQUEST>Export</TALLYREQUEST><TYPE>Collection</TYPE><ID>TestLedgerList</ID></HEADER><BODY><DESC><TDL><TDLMESSAGE><COLLECTION NAME='TestLedgerList' ISMODIFY='NO'><TYPE>Ledger</TYPE ><FETCH>name,OpeningBalance,GUID,MasterId</FETCH></COLLECTION></TDLMESSAGE></TDL></DESC></BODY></ENVELOPE> The response contains both the GUID and Master ID for the ledger and they are unique. I've done some research online and found some information that suggests that 1. GUIDs are used to identify companies (https://help.tallysolutions.com/tal...ally-prime/synchronisation-faq-tally/#1252879), 2. Master IDs are used to identify masters and transactions(https://help.tallysolutions.com/dev.../understanding-accounting-masters-integration). However, I'm still not quite clear on the specific difference between these two IDs and how they apply to ledgers. Can anyone please explain the difference between GUID and Master ID in the context of ledgers in TallyPrime? What are the advantages of using GUIDs and Master IDs, and in what situations should I use each one? I would appreciate any insights you can provide. Thanks in advance for your help!
GUID - (globally unique identifier) - is Unique Id generated for every record and the chance of collision is very less. MasterID - is and integer which increments whenever new master is created and its unique in masters only (Masters means - grps,ledgers,stckItem .etc) For Transaction also we have masterId which increments whenever a new transaction is created irrespective of type and its unique for transactions only There is another ID which is AlterId but increments whenever a master or voucher is altereId and its uniqueness is same as MasterId When to use What? From External Database perspective Use GUID as primary key if you want to save multiple company data in same database Use MasterId if you use single company per database. From Tally perspective: you can use masterid to alter or delete voucher or masters but you cannot use guid Reason : GUID is unique no matter what, but MasterId will collide if, multiple companies' data is merged beacuase every masterId starts from 1 References sql server - Are GUID collisions possible? - Stack Overflow Universally unique identifier - Wikipedia Note: This is what I found on my own and there are no official docs about them from Tally
To avoid collision use RemoteID. Each data source should post with its own Remoteid. This was found through testing for 'Merge Duplicate Ledger' utility. For a company created with earlier version like ERP use AlterID not MasterID. This holds good even if your present application is Prime.