Index: trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- trunk/ippToPsps/jython/detectionbatch.py	(revision 37577)
+++ trunk/ippToPsps/jython/detectionbatch.py	(revision 37592)
@@ -607,4 +607,17 @@
 
     '''
+    Updates table and generates pspsuniqueids
+    '''
+
+    def updatePspsUniqueIDs(self,table):
+        sql = "UPDATE "+table+" join (select @r:=@r+1 rownum, objID from \
+        (select @r:=0) r, "+table+" t) as foo using (objID) set \
+        uniquePspsP2id = ((" +str(self.batchID)+ "*1000000000 ) + rownum)"
+        try: self.scratchDb.execute(sql)
+        except:
+            self.logger.errorPair('failed sql',sql)
+            return
+        
+    '''
     Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
     '''
@@ -637,4 +650,6 @@
         results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + chipname, "objID")
         #self.logger.info("deleted nulls")
+        self.logger.info("add psps unique p2 ids")
+        self.updatePspsUniqueIDs("Detection_" + chipname, self.imageIDs[chipname])
         self.updateImageID("Detection_" + chipname, x, y)
         #self.logger.info("updateImageId")
