diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
index 5dc1717a4289ecee19c4ec4f30aefa1edb4dccb7..5622a3c78f9eb9037f4c946dc614811f9dcc0aed 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
@@ -1391,14 +1391,8 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio
         querySampleTypeId.setParameter("sampleTypeCode", sampleTypeCode);
         int sampleTypeId = ((Number) querySampleTypeId.uniqueResult()).intValue();
 
-        SQLQuery querySampleTypePrefix = currentSession.createSQLQuery("SELECT generated_code_prefix from sample_types WHERE code = :sampleTypeCode");
-        querySampleTypePrefix.setParameter("sampleTypeCode", sampleTypeCode);
-        String sampleTypePrefix = ((String) querySampleTypePrefix.uniqueResult());
-
-        SQLQuery querySampleCount =
-                currentSession.createSQLQuery("SELECT COUNT(*) FROM samples_all WHERE saty_id = :sampleTypeId AND code ~ :codePattern");
+        SQLQuery querySampleCount = currentSession.createSQLQuery("SELECT COUNT(*) FROM samples_all WHERE saty_id = :sampleTypeId");
         querySampleCount.setParameter("sampleTypeId", sampleTypeId);
-        querySampleCount.setParameter("codePattern", "^" + sampleTypePrefix + "[0-9]+$");
         long sampleCount = ((Number) querySampleCount.uniqueResult()).longValue();
 
         return sampleCount;