?
Solved

How do I use & symbol as part of text in an Access query?

Posted on 2009-05-07
14
Medium Priority
?
325 Views
Last Modified: 2012-05-06
I'm trying to write a simple query where the & symbol is part of the name (say, D&D Enterprises or D&D Players).  I'm trying to find everything that starts with D&D, but no combination of quotes and wildcard symbols seems to work.  Any ideas?

Thanks...Dave
0
Comment
Question by:dwarfield2k2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
14 Comments
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24326045
Do you want to select data that includes & with a wildcard or do you want to name a field with &?
0
 
LVL 41

Accepted Solution

by:
ralmada earned 400 total points
ID: 24326143
select ... from yourtable
where yourcolumn like '%D&D%'
0
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24326243
What database? Works for me (Access) without problem. Have you tried

where yourcolumn like '%D&&D%'
0
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 

Author Comment

by:dwarfield2k2
ID: 24326349
I want to include data that includes the &.  The "&" is part of the name.
0
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24326417
Try to use the char function

INSERT INTO TEST(TEXT) VALUES('D' || chr(38) || 'D')
0
 
LVL 41

Expert Comment

by:ralmada
ID: 24326429
Another possibility is (again in SQL)
where charindex('&', yourcolumnname) <> 0
or another:

where patindex('%D&D%', yourcolumnname) <> 0  
btw, make sure your database collation is not case sensitive, or check for typos
0
 

Author Comment

by:dwarfield2k2
ID: 24326609
Access drives me to distraction, because the wildcard operator that works for it, apparently isn't ANSI standard SQL.  I had to use * instead of %, so the expression that worked was like '*D&D*' I didn't use caps--usually I don't get lazy about case, but at the same time usually it doesn't make a difference with Access--until today!  Thanks.
0
 
LVL 41

Expert Comment

by:ralmada
ID: 24326669
Next time make sure you clarify what database you are using, so we can post the solution that you are looking for. thanks.
0
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24326754
Yep - though you want to do this in Oracle or somehting else, because of the wildcards - thats why I ask for the database. But keep in mind that you have to switch back to %, if you have an ODBC-table linked against an access-table, very confusing %-)
0
 

Author Comment

by:dwarfield2k2
ID: 24326840
Okay...sorry  about that.  I should have been over in the Access Zone anyway.  I guess something's moving me away from Access and back to Oracle!
0
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24326917
can only be gravity :-)
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24341598
>>Next time make sure you clarify what database you are using<<
It is in the title as in:
How do I use & symbol as part of text in an Access query?
0
 

Author Closing Comment

by:dwarfield2k2
ID: 31579005
The only reason I said "partially" was because of the SQL vs Access query wildcard issue.  Your suggestion gave me the spark I needed.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question