473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

REPLACE in WHERE CLAUSE

JAMBAI
28
Hi,

Please let me know is it possible to achieve the below query in MS Access.

I have tried with " " (double quote) also in the replace. it doesn't help me.

SELECT * FROM dbo_Facility WHERE (REPLACE(REPLACE(REPLACE(NAME,',',''),'.',''),'''' ,'') LIKE 'jambai %')

Thanks
Jambai
Feb 24 '07 #1
12 9017
vijaydiwakar
579 512MB
Hi,

Please let me know is it possible to achieve the below query in MS Access.

I have tried with " " (double quote) also in the replace. it doesn't help me.

SELECT * FROM dbo_Facility WHERE (REPLACE(REPLACE(REPLACE(NAME,',',''),'.',''),'''' ,'') LIKE 'jambai %')

Thanks
Jambai
show me some data and description of thy tbl
Feb 24 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Unless this is a pass thru query you will need to change % to * which is the wildcard in Access.

Replace function looks ok but I would put NAME in square brackets and your closing bracket is in the wrong place. Try this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT * FROM dbo_Facility 
  3. WHERE (REPLACE(REPLACE(REPLACE([NAME],",",""),".",""),"'",""))  
  4. LIKE "jambai*")
  5.  
Mary
Feb 24 '07 #3
JAMBAI
28
Unless this is a pass thru query you will need to change % to * which is the wildcard in Access.

Replace function looks ok but I would put NAME in square brackets and your closing bracket is in the wrong place. Try this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT * FROM dbo_Facility 
  3. WHERE (REPLACE(REPLACE(REPLACE([NAME],",",""),".",""),"'",""))  
  4. LIKE "jambai*")
  5.  
Mary
I tried your query, it didn't work.

Data type mismatch in criteria expression was the error message. And the data type of the column is text. One more thing the table is a linked table from SQL 2000.

Thanks
jambai
Feb 24 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
I tried your query, it didn't work.

Data type mismatch in criteria expression was the error message. And the data type of the column is text. One more thing the table is a linked table from SQL 2000.

Thanks
jambai
Did you copy and paste the code exactly?

Try this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT dbo_Facility.*, 
  3. (REPLACE(REPLACE(REPLACE(dbo_Facility.[NAME],",",""),".",""),"'",""))
  4. FROM dbo_Facility 
  5. WHERE (REPLACE(REPLACE(REPLACE(dbo_Facility.[NAME],",",""),".",""),"'",""))  
  6. LIKE "jambai*")
Feb 26 '07 #5
NeoPa
32,556 Expert Mod 16PB
Hi,

Please let me know is it possible to achieve the below query in MS Access.

I have tried with " " (double quote) also in the replace. it doesn't help me.

SELECT * FROM dbo_Facility WHERE (REPLACE(REPLACE(REPLACE(NAME,',',''),'.',''),'''' ,'') LIKE 'jambai %')

Thanks
Jambai
Replace will not work on versions of Access prior to 2K.
The '%' as a wildcard is only right in 2003 or later and where set to full ANSI compatibility mode.
Feb 26 '07 #6
JAMBAI
28
Replace will not work on versions of Access prior to 2K.
The '%' as a wildcard is only right in 2003 or later and where set to full ANSI compatibility mode.
Are you talking about the REPLACE in left side of the WHERE caluse. Because the Replace in the right side of the where clause is working fine

Thanks
Jambai
Feb 26 '07 #7
NeoPa
32,556 Expert Mod 16PB
I'm unclear what you'd be referring to as the left or right sides of the WHERE clause. Nor do I know which version of Access you're using.
I was simply mentioning, for reference, that Replace() doesn't exist in versions prior to 2K. If you're telling me you use Access 97 or earlier and it works for you then I'm surprised :confused:
Feb 26 '07 #8
JAMBAI
28
I'm unclear what you'd be referring to as the left or right sides of the WHERE clause. Nor do I know which version of Access you're using.
I was simply mentioning, for reference, that Replace() doesn't exist in versions prior to 2K. If you're telling me you use Access 97 or earlier and it works for you then I'm surprised :confused:

I am using MS Access 2002 and the replace is working fine in the below query
SELECT * FROM dbo_Facility WHERE [NAME] Like Replace('jambai',',','')));

I am wondering ist possible to create the below query.
Please see the marked code, this was the one I referred as left side of the where clause
SELECT * FROM dbo_Facility WHERE (REPLACE([NAME],',','') LIKE 'jambai%'

Thanks
Jambai
Feb 28 '07 #9
NeoPa
32,556 Expert Mod 16PB
Ah, I understand what you mean now.
Yes.
...is the simple answer. SQL will deal with it on either side in that sense :)
Feb 28 '07 #10
JAMBAI
28
Ah, I understand what you mean now.
Yes.
...is the simple answer. SQL will deal with it on either side in that sense :)
Thanks NeoPa,

Please let me know how to achive the same query in MS ACCESS 2002

SELECT * FROM dbo_Facility WHERE (REPLACE([NAME],',','') LIKE 'jambai%'

Thanks
Jambai
Feb 28 '07 #11
NeoPa
32,556 Expert Mod 16PB
Thanks NeoPa,

Please let me know how to achive the same query in MS ACCESS 2002

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM dbo_Facility
  3. WHERE (Replace([NAME],',','') Like 'jambai%'
Thanks
Jambai
Exactly as you have it should work fine (except you should replace the % with a *).
Feb 28 '07 #12
JAMBAI
28
Exactly as you have it should work fine (except you should replace the % with a *).
Data type mismatch in criteria expression was the error message, when I tried that query

Yes I replaced the % with *.

Thanks
Kumar
Feb 28 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: A.V.C. | last post by:
Hello, I found members of this group very helpful for my last queries. Have one problem with CASE. I can use the column name alias in Order By Clause but unable to use it in WHERE CLAUSE. PLS...
5
by: comp.lang.php | last post by:
$orderBy = 's.app_date desc, s.last_name asc, s.first_name asc, s.mi asc'; if ($_REQUEST) { $ascArray = array('asc' => 'desc', 'desc' => 'asc'); // ARRAY OF ALL ORDERING POSSIBILITIES $junk =...
2
by: Curtiosity | last post by:
I have done a create or replace view called creditcard1. If I do a "select * from creditcard1" it retrieves the data just fine. If I try to do a statement where I am listing the column names it...
8
by: Captain Dondo | last post by:
I have an array(?) (sorry, I'm new* to python so I'm probably mangling the terminology) that looks like this: I want to replace every instance of 'tooth.seiner.lan' with 'localhost'. There...
2
by: Jim.Mueksch | last post by:
I am having a problem with using calculated values in a WHERE clause. My query is below. DB2 gives me this error message: Error: SQL0206N "APPRAISAL_LESS_PRICE" is not valid in the context where...
8
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 ,...
5
by: pwiegers | last post by:
Hi, I'm trying to use the result of a conditional statement in a where clause, but i'm getting 1)nowhere 2) desperate :-) The query is simple: -------- SELECT idUser,...
6
by: JackpipE | last post by:
Here is my replace query and I need to run this on every column in my table. Right now I manually enter the column name (_LANGUAGES_SPOKEN) but this is time consuming and would like to automate...
4
by: tkltechy | last post by:
I have a sql query that unions two recordsets. It works when I don't try to adjust the ORDER BY clause using the replace function. However, I want to ensure that a certain item in the list always...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.