SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 PATINDEX
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Freddie
Starting Member

Canada
29 Posts

Posted - 02/13/2007 :  14:32:07  Show Profile  Reply with Quote
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

Sweden
30281 Posts

Posted - 02/13/2007 :  15:03:23  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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

Canada
29 Posts

Posted - 02/13/2007 :  15:17:18  Show Profile  Reply with Quote
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

Sweden
30281 Posts

Posted - 02/13/2007 :  15:23:33  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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

Canada
29 Posts

Posted - 02/13/2007 :  16:24:21  Show Profile  Reply with Quote
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

Sweden
30281 Posts

Posted - 02/15/2007 :  03:01:57  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000