SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 11th, 2004, 01:28 PM
taffy taffy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 18 taffy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 17 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 11th, 2004, 02:25 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Taffy - I believe you want to change the * characters to a % character, as the % is the wildcard character in sql.


Reply With Quote
  #3  
Old June 11th, 2004, 02:34 PM
Username=NULL Username=NULL is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: TX
Posts: 249 Username=NULL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 6 m 42 sec
Reputation Power: 5
Send a message via Yahoo to Username=NULL
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?

Reply With Quote
  #4  
Old June 11th, 2004, 03:20 PM
taffy taffy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 18 taffy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 17 sec
Reputation Power: 0
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

Reply With Quote
  #5  
Old June 11th, 2004, 03:41 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 25th Plane (17000 - 17499 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,331 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 5 Days 7 h 21 m 33 sec
Reputation Power: 891
could the fact that you're searching for a date inside the customer name have anything to do with it?
__________________
r937.com | rudy.ca

Reply With Quote
  #6  
Old June 12th, 2004, 11:17 AM
taffy taffy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 18 taffy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 17 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Query based on text


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway