Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple/Not So Simple Select

Status
Not open for further replies.

ghost807

IS-IT--Management
Jun 27, 2003
99
US
i need to be able to use a an sql statement to pull data that could possibly have Numbers,Quotes,PoundSigns,Comma's
if i could find a statement that would work with
Joe's#1 Bar & Grill
i've been trying but i just can't seem to get anything to work.

Any Help Would be appreciated.
Dave Jr.
 
What exactly are you trying to do? Based on your question, you can just SELECT the column and get that information returned.

Or SELECT mycolumn
FROM mytable
WHERE mycolumn LIKE 'Joe%'

-SQLBill
 
If you are asking how to query a table with special characters, it's easy.
The only special character that will pose a problem is the single quote.

Example:

SELECT BarName, Address, City
From BarTable
WHERE BarName LIKE 'Joe''s%'

If there is a single quote in the search criteria, add another single quote next to the original.

Search criteria:
'Joe's should be 'Joe''s'

'That's not Joe's place' would be 'That''s not Joe''s'

cossiboon

 

strOne = " '" & First & "' "
strTwo = " '" & Secondz & "' "
strThree = " '" & Three & "' "
strFour = " '" & Fourth & "' "

SELECT * FROM tblMovie WHERE MajorChar1 = " & strOne & " AND MajorChar2 = " & strTwo & " AND MajorChar3 = " & strThree & ";"
This will work to build a user defined statement that will fill a table or datagrid from the results the user puts in.
this will be filled from a listbox or combobox(not sure yet)
The problem is when i come upon a special char like " or '

Once i can get this to work i'm either going to fill a table or a datagrid. (whichever is easier)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top