• Indeed, you are making a crucial mistake by not using appropriate datatypes.

    The penalty you give yourself is tons of problems you will experience now and in the future, and even more time to fix them.

    Cheaper and faster is to use the right datatype for all columns. In this case, date.

    Field1 string with format YYYYMMDD would become real date, not string.

    Field2 and Field3 with format QQYY would also become real date. E.g. 2Q12 would become date 2012-04-01.

    It will be easier and cleaner if you create deterministic function to convert from QQYY to date.

    If you do not want to change existing fields, alternative is to add 3 new calculated non-persistent fields of datatype DATE,

    create indexes on those field(s) and use those calculated fields in your WHERE clause.

    It will be much much faster because you have index on that field and optimizer can use it because there is no function around that field.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths