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
 Script Library
 PATINDEX

Author  Topic 

Freddie
Starting Member

29 Posts

Posted - 2007-02-13 : 14:32:07
Hello everyone:

how do i find a single quote ['] with the patindex function.

SELECT 'a company's name'

thx,

F.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-13 : 15:03:23
Try double single quotes.
declare @s varchar(50)

select @s = 'a company''s name'

select @s, patindex('%''%', @s)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Freddie
Starting Member

29 Posts

Posted - 2007-02-13 : 15:17:18
Hi Peter:

already tried ... it is looking for a space.

quote:
Originally posted by Peso

Try double single quotes.
declare @s varchar(50)

select @s = 'a company''s name'

select @s, patindex('%''%', @s)


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-13 : 15:23:33
Are you really really really really really really really really really sure?

I suggest you test it first.
And don't type by hand. Do a copy and paste operation, please!!!

And when the result is in front of you, calculate whiich character is the 10th.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Freddie
Starting Member

29 Posts

Posted - 2007-02-13 : 16:24:21
ok...you're right...it works.

thx!!

quote:
Originally posted by Peso

Are you really really really really really really really really really sure?

I suggest you test it first.
And don't type by hand. Do a copy and paste operation, please!!!

And when the result is in front of you, calculate whiich character is the 10th.


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-15 : 03:01:57
And hereafter, do not post in this forum for answers. This forum is for posting working queries that can benefit other people.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -