Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-07
14
Medium Priority
?
326 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

604 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