How do you come up with percentages for how close of a match a certain result is to a query that contains a LIKE in the WHERE statement?

And if that's easy enough, how do I order them in the best match order?

OH, and I'm using MS SQL Server and PHP although as long as someone can give me the SQL theory, I can figure out the rest.