Sử dụng các kí hiệu và các Phạm vi của các giá trị trong một SQL Query tôi cần để có thể hoặc là tìm kiếm cho một loạt các giá trị, hoặc ít nhất là có thể sử dụng thẻ hoang dã với truy vấn của tôi. Làm thế nào để làm điều này bằng cách sử dụng T-SQL? Kỹ thuật này là một trong những người khá đơn giản nhưng cần thiết như thế nào-TOS | Use Wildcards and Ranges of Values in a SQL Query I need to be able to either search for a range of values or at least be able to use wild cards with my query. How do I do this using T-SQL Technique This is one of those fairly simple but necessary How-Tos. You will learn how to use a combination of both wild cards and a range of values. Here is the T-SQL routine that you will use for this How-To SELECT FROM Orders INNER JOIN Customers ON WHERE LIKE A AND BETWEEN 11 01 1996 AND 12 01 1996 Note The literal values have been used here rather than the text box values that will be used in the How-To. Using Wild Cards Fairly similar to the wild cards of the old DOS days wild cards in T-SQL are fairly straightforward to use. It is just a matter of knowing which one to use for which task. When using wild cards you will use the LIKE operator as seen in the SQL string for this How-To. You can see where the LIKE operator is used with A . The is used to specify anything after the given letter. In this case it s used for anything starting with the letter A. This operator will of course have to have the OrderDate fall between the dates specified but we ll talk about this in a moment. You can use other wild cards as well such as the following Percent sign . You use this to specify any given group of characters. If used before a letter or group of letters you are then specifying that you want values ending with those letters. For instance if you specify ing you get skiing flying and so on. _ Underscore . You use this to specify a single character. For instance if you type _ake then you would get four-letters words such as lake bake and sake. Square brackets This is a range or group of characters to compare against. For example if you type B-D ake you would get bake and cake. Another way to use it with a group of letters would be to type BF ake. In .