SQL case indexes

#3329
yea, can probably make them 64