|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Query based on text
Hi -
I am trying to do a query based on a table. I have a field called Comments and I want to use SQL codes to get certain information (the code will be tied to command button on a form. If I use LIKE *documents*, it will give me all records that have the word "document" in it. That is fine. However, if I use Like "*05/11/2004*" it does not return any records. I would expect that a record that has a comment "Contacted person on 05/11/2004, I will try again" would meet the criteria. Can you say what I am I doing wrong? Is there another approach? This the exact code that I use: SELECT Outside.[A/R REP], Outside.[CUST CODE], Outside.[CUSTOMER NAME] FROM Outside WHERE (((Outside.[CUSTOMER NAME]) Like "*05/01/2004*")); Thanks. Taffy |
|
#2
|
|||
|
|||
|
Taffy - I believe you want to change the * characters to a % character, as the % is the wildcard character in sql.
![]() |
|
#3
|
|||
|
|||
|
wildcard char depends on the DBMS...you say that using like "*documents*" sucessfully returns data, so you're implying that you're using MS Access.
Can you post the table name and fields and a few sample rows? |
|
#4
|
|||
|
|||
|
Thanks all. I am indeed using MS Access.
My table and sample is as follows: CUST_NUM ------------- CUST_NAME ------------ COMMENT 12345 ---------------- John Brown ------------ Called John on 04/12/2004. 12346 -----------------Tom Strokes----------- Tom called 05/11/2004, will call back 12347------------------Mary Jane ------------- Paid on 04/12/2004. Now current 12348------------------May Gayle ------------- 06/11/2004, customer to pay today I want to query the database so that I get a list of all persons who have a particular date in the comment field. Therefore, if i query on 04/12/2004, the two records should be selected. Thanks. Taffy |
|
#5
|
||||
|
||||
|
could the fact that you're searching for a date inside the customer name have anything to do with it?
|
|
#6
|
|||
|
|||
|
Guys!
Thanks, I figured the problem. I actually searched under the COMMENT column, but I was searching for 06/11/2004 instead of 6/11/2004. That is why no records were returned. Thanks for all your assistance, though. Taffy. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Query based on text |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|