Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Filter on ' in name

Author  Topic 

AMB
Starting Member

6 Posts

Posted - 2007-05-17 : 06:36:48
Hi,
I have a supllier named K O'Neill and i want to filter on his name in my supplier table . Is this possible ?

When I try Vend Name = 'K O%Neill' it does not work.

Can anyone help?


Thanks.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-17 : 06:39:43
[code]Where [Name] = 'K O''Neill'[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-17 : 06:51:40
You need to double the single quote
To know how it behaves run this

Select '','''','''''','''''''',''''''''''

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

AMB
Starting Member

6 Posts

Posted - 2007-05-17 : 06:55:16
the where vend name = 'k o' 'neill' does not work :(
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-17 : 07:06:42
quote:
Originally posted by AMB

the where vend name = 'k o' 'neill' does not work :(



where [vend name] = 'k o''neill'


Also, don't give space between two consecutive quotes.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

AMB
Starting Member

6 Posts

Posted - 2007-05-17 : 09:53:36
Harsh Athalye thank you very much that works :) :) :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-17 : 10:44:26
Instead of space it is better to use underscore (_)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -