--select * from sSystem.tDatabaseInfo
--select * from ssetup.torganizationmaster
--select * from ssetup.torgGroupMaster
--select * from scommon.ttablerowid
 
   DECLARE @lOrgGroupMaster Table(Id int identity(1,1),OrgGroupId int);
   INSERT INTO @lOrgGroupMaster SELECT Id from ssetup.tOrgGroupMaster;
   DECLARE @lCount int=0; SELECT @lCount=COUNT(Id) from ssetup.tOrgGroupMaster;
   WHILE (@lCount>0)
   BEGIN
   DECLARE @lOrgGroupId int =0;
   SELECT @lOrgGroupId=OrgGroupId from @lOrgGroupMaster WHERE Id=@lCount
   SELECT @lOrgGroupId
   exec sTool.pUpgradeVersion @rVersionId = 240915,@rVersion = '24.09.15',@rOrgGroupId = @lOrgGroupId
   SET @lCount=@lCount-1
   END;
   
GO


 