SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL 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 ASP Free Forums Sponsor:
  #1  
Old October 9th, 2000, 09:43 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
SELECT EMP.ID WHERE EMP.ID LIKE 'RO*' doesn't work

<i><b>Originally posted by : Armando Corazon (a_corazon@hotmail.com)</b></i><br />Does anybody knows why I can't retrieve any record from a table usin the Like filter in an SQL Statement??<br /><br /> <br />For example:<br /><br />Set rs = Server.CreateObject("ADODB.Recordset")<br />rs.CursorLocation= 3 ' adUseClient<br />conn.Open "DSN=BOTAO;"<br />strSql = "SELECT EMP.ID " & _<br /> "FROM PARTES " & _<br /> "WHERE EMPID LIKE '" & request("id") & "';"<br />rs.Open strSql, conn ', adOpenStatic<br /><br />Thanks <br /><br />Armando<br />

Reply With Quote
  #2  
Old November 10th, 2000, 07:56 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
<i><b>Originally posted by : Martin Burford (Not Submitted)</b></i><br />Yup, I can.<br /><br />The problem DOES NOT lie in the LIKE command in the following example. You do not have the correct line carriage returns on the SQL statement.<br /><br />It should work with the following syntax:-<br /><br />strSql="SELECT EMP.ID"& _<br />strSql=strSql &"FROM PARTES"& _<br />strSql=strSql &"WHERE EMPID LIKE"&_<br />strSql=strSql &"'"& Request("id")"'";<br /><br />Regards<br />Martin<br />

Reply With Quote
  #3  
Old November 14th, 2003, 06:11 AM
lvramani lvramani is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 14 lvramani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile DataType

Dear User,

At the very begining i am assuming that your EMPID is Integer datatype. If so then LIKE operator will never work.

LIKE operator works only with character strings matching a specific pattern.

If the EMPID is a character datatype then you must user '%' instead like '*'

Your query stands like --
Query = "SELECT EMP.ID FROM PARTES "
Query = Query + "WHERE EMP.ID LIKE '" & request("id") & "%'";

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > SELECT EMP.ID WHERE EMP.ID LIKE 'RO*' doesn't work


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 5 hosted by Hostway
Stay green...Green IT