Small. Fast. Reliable.
Choose any three.
I could not find any info on converting and comparing to avoid type confusion. Is there a way to guarentee that comparisons are of a given type?

For example, I am looking for something like:

  ...WHERE NUMBER(A) > NUMBER(B)  // dummy sql

  ...ORDER BY NUMBER(X), STRING(Y)  // dummy sql

In other words, how does one guarentee that comparisons are being interpreted as the needed or expected type? (This is assuming I don't want to pre-declare column types)


Please use the mailing list to ask questions like this. See http://www.sqlite.org/support.html for instructions on how to access the mailing list.

Reply: Pardon my question, but doesn't a maillist defeat the purpose of a wiki? The wiki avoids reinventing the wheel when another person has the same issue or question.

Further reply: The mailing list is archived; those archives can be searched. For what it's worth, what you're looking for is CAST(); see the expressions documentation. On the subject of the suitability of wiki, I may be wrong, but isn't the point of wiki to collect facts? What you've done here is ask a question, not post a fact. Certainly a mailing list is a very good place to ask a question, as many, many people will be receiving it and will have an opportunity to answer. Wiki pages can go unnoticed by all but the most diligent for a very long time.

Reply: I've seen wiki's used for a lot of purposes. In my opinion, their shining point is to quickly create, edit, and link topics. Maillists are just a big string of unorganized text. After a while the question can perhaps be turned into an example so that it is a "fact". I searched for "convert", "compare", "to_string", "to_number", etc. in an effort to find an answer, and just plain couldn't. Now that this topic is created, ANYBODY else using those same keywords can now find the answer you gave (CAST). I would like to thank you for answering my question, but I disagree with relying on maillists for such. (Thanks for letting me state my opinion.)