Looking at the IF statement, please bear in mind that the ordering of results of a SELECT are not guaranteed.
Try maybe (select top 1 GBankAllocInfCheckID from PCLAWDB_56830.dbo.GBAlloc ORDER BY GBankAllocInfCheckID) <> (select Top 1 GbankCommInfID from PCLAWDB_56830.dbo.GBComm ORDER BY GbankCommInfID)
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”