|
-
Nov 11th, 2004, 04:19 AM
#1
Thread Starter
KING BODWAD XXI
SQL Search for ' (*RESOLVED*)
I think this is the right forum for it
Its an SQL question
how do I do a search for a string containing the ' char eg
50's 60's etc. Whenever I try I get an operator error because ' is a used element in SQL. You must be able to search for it though cant you
E.g
SELECT * FROM [AllTable] WHERE [AllIdeas] LIKE *'50's'*
I tried
SELECT * FROM [AllTable] WHERE [AllIdeas] LIKE *'[50's]'*
Anyone know this one?
Last edited by BodwadUK; Nov 11th, 2004 at 04:35 AM.
-
Nov 11th, 2004, 04:23 AM
#2
Use replace function on the users input and wildcards...
And you'd need to move the single quotes to enclose the asterisks
Code:
SELECT * FROM [AllTable] WHERE [AllIdeas] LIKE '*50?s*'
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Nov 11th, 2004, 04:25 AM
#3
Fanatic Member
make a double single quote for every single quote?
-
Nov 11th, 2004, 04:28 AM
#4
Thread Starter
KING BODWAD XXI
Silly question does ? mean any char?
-
Nov 11th, 2004, 04:33 AM
#5
Hi Bod
If your are using m$ sql server this is your should to the query
SELECT * FROM TableName WHERE TableField like ' %' + char(39) + '%'
Regards
Jorge
"The dark side clouds everything. Impossible to see the future is."
-
Nov 11th, 2004, 04:35 AM
#6
The question mark (?) is a wildcard. It looks for any one character in place of the ?
So searching for
50?s
would return anything containing
50Ms
50's
50#s
and so on.
But it would NOT return
50####s
-
Nov 11th, 2004, 04:35 AM
#7
Thread Starter
KING BODWAD XXI
yay I put * in instead of ' and it works
Didnt realise what you meant by wild card until my brain kicked in
Thanks you two
-
Nov 11th, 2004, 04:37 AM
#8
Thanking me too, Boddy Woddy? :flirt:
-
Nov 11th, 2004, 05:24 AM
#9
Thread Starter
KING BODWAD XXI
Thanks everyone who posted in this thread if I could snog you I would
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|