Short and to the point, your XSD snippet could be correct and here are some things to consider:
Your use of the word max makes me think that less might also be allowed. In which case, your pattern needs maintenance.
<xsd:simpleType name="cstCODE"> 
    <xsd:restriction base="xsd:string"> 
        <xsd:pattern value="[0-9]{1,2}"/> 
        <xsd:maxLength value="2"/> 
    </xsd:restriction> 
</xsd:simpleType> 
It is also interesting (could be unintended) your use of an xsd:string as a base type for what seems to be a numeric value; it is an important distinction in scenarios where one wants to allow empty values on the wire, without using nillable. Then your pattern may look like:
<xsd:simpleType name="cstCODE"> 
    <xsd:restriction base="xsd:string"> 
        <xsd:pattern value="[0-9]{0,2}"/> 
        <xsd:maxLength value="2"/> 
    </xsd:restriction> 
</xsd:simpleType> 
Another problem here might be that related to positive/negative numbers, and/or 0 padding. This is where the patterns can get a bit more complicated. 
If your use of xsd:string as a base type is rather part of the learning curve, then you could achieve the same "range" limitation using a numeric base type, and the facets that come with it. Once in a while I revisit this chart; in there you can choose a type that matches your needs, click on it, and see what constraining facets apply to it. For, e.g., if I choose an unsignedShort then:
<xsd:simpleType name="cstCODE"> 
    <xsd:restriction base="xsd:unsignedShort"> 
        <xsd:totalDigits value="2"/> 
    </xsd:restriction> 
</xsd:simpleType>