<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Search Text Field &#8211; CHARINDEX vs PATINDEX</title>
	<atom:link href="http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:22:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-136378</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Tue, 24 May 2011 11:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-136378</guid>
		<description><![CDATA[Refer this post
http://beyondrelational.com/blogs/madhivanan/archive/2010/04/22/extracting-numbers-part-2.aspx]]></description>
		<content:encoded><![CDATA[<p>Refer this post<br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2010/04/22/extracting-numbers-part-2.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2010/04/22/extracting-numbers-part-2.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-136178</link>
		<dc:creator><![CDATA[Jack]]></dc:creator>
		<pubDate>Mon, 23 May 2011 09:12:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-136178</guid>
		<description><![CDATA[I&#039;ve been trying to get an amount value out of an ntext field based on this info. I can&#039;t get it to work.

The field can have values like

&#039;1. text here € 100.000 text here&#039;

normally amount will start with €. How can i extract € 100.000 or just 100.000 from the field?]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve been trying to get an amount value out of an ntext field based on this info. I can&#8217;t get it to work.</p>
<p>The field can have values like</p>
<p>&#8217;1. text here € 100.000 text here&#8217;</p>
<p>normally amount will start with €. How can i extract € 100.000 or just 100.000 from the field?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-132493</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 02 May 2011 10:41:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-132493</guid>
		<description><![CDATA[where col like [%~!#$%^&amp;*()_+%]]]></description>
		<content:encoded><![CDATA[<p>where col like [%~!#$%^&amp;*()_+%]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dharmendra</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-131922</link>
		<dc:creator><![CDATA[Dharmendra]]></dc:creator>
		<pubDate>Fri, 29 Apr 2011 06:04:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-131922</guid>
		<description><![CDATA[Hi,
    This is dharmendra here.
I want to ask a question as if:-

&quot;How to find the column values with special characters?&quot;]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
    This is dharmendra here.<br />
I want to ask a question as if:-</p>
<p>&#8220;How to find the column values with special characters?&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srikanth</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-106703</link>
		<dc:creator><![CDATA[Srikanth]]></dc:creator>
		<pubDate>Sun, 19 Dec 2010 08:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-106703</guid>
		<description><![CDATA[Hi All 

PatIndex = CHARINDEX + Wild card characters

WildCard characters are :
%
_
[]
Example For PATINDEX:
SELECT CHARINDEX(&#039;kan&#039;, &#039;Hi Friends this is srikanth from suvara technosoft &#039;)
SELECT PATINDEX(&#039;%___ka%h%&#039;, &#039;Hi Friends this is srikanth from suvara technosoft &#039;)]]></description>
		<content:encoded><![CDATA[<p>Hi All </p>
<p>PatIndex = CHARINDEX + Wild card characters</p>
<p>WildCard characters are :<br />
%<br />
_<br />
[]<br />
Example For PATINDEX:<br />
SELECT CHARINDEX(&#8216;kan&#8217;, &#8216;Hi Friends this is srikanth from suvara technosoft &#8216;)<br />
SELECT PATINDEX(&#8216;%___ka%h%&#8217;, &#8216;Hi Friends this is srikanth from suvara technosoft &#8216;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-86727</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 06 Sep 2010 06:45:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-86727</guid>
		<description><![CDATA[Do you need to know number of tables that has empid or tables that has particular empid value?]]></description>
		<content:encoded><![CDATA[<p>Do you need to know number of tables that has empid or tables that has particular empid value?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raj</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-86464</link>
		<dc:creator><![CDATA[raj]]></dc:creator>
		<pubDate>Fri, 03 Sep 2010 12:46:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-86464</guid>
		<description><![CDATA[you can use following query for sql 2005:

select * from sysobjects where id in (select id from syscolumns where name =&#039;empid&#039;)]]></description>
		<content:encoded><![CDATA[<p>you can use following query for sql 2005:</p>
<p>select * from sysobjects where id in (select id from syscolumns where name =&#8217;empid&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-84422</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Tue, 17 Aug 2010 13:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-84422</guid>
		<description><![CDATA[First do the SELECT

SELECT left(SCREDITCARDNO,6)+&#039;******&#039;+right(SCREDITCARDNO,4) FROM ContactDetails]]></description>
		<content:encoded><![CDATA[<p>First do the SELECT</p>
<p>SELECT left(SCREDITCARDNO,6)+&#8217;******&#8217;+right(SCREDITCARDNO,4) FROM ContactDetails</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shalini</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-84403</link>
		<dc:creator><![CDATA[Shalini]]></dc:creator>
		<pubDate>Tue, 17 Aug 2010 11:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-84403</guid>
		<description><![CDATA[Hi All

I have a requirement to change a column&#039;s value in a table carrying 16 digit credit card number(Column name is &#039;SCREDITCARDNO&#039; and data type is varchar(50),table name is &#039;ContactDetails&#039;) into----&gt;

First 6 digit of credit card number, followed by ******  (6 starts) and then followed by last 4 digit of the credit card number.
 
It&#039;s SQL Srver 2005.

Please help me with this.]]></description>
		<content:encoded><![CDATA[<p>Hi All</p>
<p>I have a requirement to change a column&#8217;s value in a table carrying 16 digit credit card number(Column name is &#8216;SCREDITCARDNO&#8217; and data type is varchar(50),table name is &#8216;ContactDetails&#8217;) into&#8212;-&gt;</p>
<p>First 6 digit of credit card number, followed by ******  (6 starts) and then followed by last 4 digit of the credit card number.</p>
<p>It&#8217;s SQL Srver 2005.</p>
<p>Please help me with this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-84228</link>
		<dc:creator><![CDATA[Tejas]]></dc:creator>
		<pubDate>Mon, 16 Aug 2010 03:00:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-84228</guid>
		<description><![CDATA[Hi Tejas Shah,

Software considers only &#039;Comma&#039;. So its not working. I think, i need to check individually. 
So my option is export it to excel, Ctrl+F, check the fields where commas exist, then replace in sql. Still, its too time consuming. Thanks for ur suggestion. I can use it for some other softwares.

Regards,
Tejas]]></description>
		<content:encoded><![CDATA[<p>Hi Tejas Shah,</p>
<p>Software considers only &#8216;Comma&#8217;. So its not working. I think, i need to check individually.<br />
So my option is export it to excel, Ctrl+F, check the fields where commas exist, then replace in sql. Still, its too time consuming. Thanks for ur suggestion. I can use it for some other softwares.</p>
<p>Regards,<br />
Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-83617</link>
		<dc:creator><![CDATA[Tejas]]></dc:creator>
		<pubDate>Tue, 10 Aug 2010 16:59:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-83617</guid>
		<description><![CDATA[Hi Tejas,

Thanks for your response. I will do it tomorrow and will let you know.

Thanks,
Tejas]]></description>
		<content:encoded><![CDATA[<p>Hi Tejas,</p>
<p>Thanks for your response. I will do it tomorrow and will let you know.</p>
<p>Thanks,<br />
Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas Shah</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-83568</link>
		<dc:creator><![CDATA[Tejas Shah]]></dc:creator>
		<pubDate>Tue, 10 Aug 2010 06:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-83568</guid>
		<description><![CDATA[Hi Tejas,

You should export data to CSV with text qualifier like  &quot;. So your data looks like: &quot;Tejas, Shah&quot;,&quot;AAAA&quot;,&quot;BBB&quot; etc..

So when software tries to import it, it will not consider &quot;,&quot; between qualifier.

Let me know if it helps you.

Thanks,
Tejas Shah
SQLYoga.com]]></description>
		<content:encoded><![CDATA[<p>Hi Tejas,</p>
<p>You should export data to CSV with text qualifier like  &#8220;. So your data looks like: &#8220;Tejas, Shah&#8221;,&#8221;AAAA&#8221;,&#8221;BBB&#8221; etc..</p>
<p>So when software tries to import it, it will not consider &#8220;,&#8221; between qualifier.</p>
<p>Let me know if it helps you.</p>
<p>Thanks,<br />
Tejas Shah<br />
SQLYoga.com</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-83503</link>
		<dc:creator><![CDATA[Tejas]]></dc:creator>
		<pubDate>Mon, 09 Aug 2010 13:59:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-83503</guid>
		<description><![CDATA[Hi,

I usually get a data from our clients in SQL. I need to import it in a software which can import it only in csv format. If there is a comma in any field in SQL (by error) it makes it as a separate column while exporting. Then the software throws an error. Hence before exporting it to a csv file, I want to know, if there is any comma in any of the fields. I know the query 

where column_name like &#039;%,%&#039;

But the problem is, there are more than 60 columns to be checked. It is very time consuming. So is there is any other simple way to search it in Database as a whole (rather than columnwise).

Regards,
Tejas]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I usually get a data from our clients in SQL. I need to import it in a software which can import it only in csv format. If there is a comma in any field in SQL (by error) it makes it as a separate column while exporting. Then the software throws an error. Hence before exporting it to a csv file, I want to know, if there is any comma in any of the fields. I know the query </p>
<p>where column_name like &#8216;%,%&#8217;</p>
<p>But the problem is, there are more than 60 columns to be checked. It is very time consuming. So is there is any other simple way to search it in Database as a whole (rather than columnwise).</p>
<p>Regards,<br />
Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78809</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 11:11:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78809</guid>
		<description><![CDATA[This is generalised method

select replace(parsename(replace(replace(data,&#039;.&#039;,&#039;*&#039;),&#039;&#124;&#039;,&#039;.&#039;),2),&#039;*&#039;,&#039;.&#039;) from
(
select &#039;DEVICE IP: &#124;192.168.2.90&#124; Puerto: 1117 01234567890 14142422 Resultado Positivo!&#039; as data
) as t

You can refer these to get more indeas
http://beyondrelational.com/blogs/madhivanan/archive/2009/11/18/parsing-a-string.aspx
http://beyondrelational.com/blogs/madhivanan/archive/2009/10/12/removing-tags-from-a-string.aspx]]></description>
		<content:encoded><![CDATA[<p>This is generalised method</p>
<p>select replace(parsename(replace(replace(data,&#8217;.',&#8217;*'),&#8217;|',&#8217;.'),2),&#8217;*',&#8217;.') from<br />
(<br />
select &#8216;DEVICE IP: |192.168.2.90| Puerto: 1117 01234567890 14142422 Resultado Positivo!&#8217; as data<br />
) as t</p>
<p>You can refer these to get more indeas<br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2009/11/18/parsing-a-string.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2009/11/18/parsing-a-string.aspx</a><br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2009/10/12/removing-tags-from-a-string.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2009/10/12/removing-tags-from-a-string.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78808</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 11:04:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78808</guid>
		<description><![CDATA[Did you get any calues when you try this?

select columns from table
where data like &#039;%fcCount%&#039;]]></description>
		<content:encoded><![CDATA[<p>Did you get any calues when you try this?</p>
<p>select columns from table<br />
where data like &#8216;%fcCount%&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78806</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 11:00:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78806</guid>
		<description><![CDATA[There is a chance that dynamic sql may outperform charidex if the XX is a indexed column]]></description>
		<content:encoded><![CDATA[<p>There is a chance that dynamic sql may outperform charidex if the XX is a indexed column</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78805</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 10:58:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78805</guid>
		<description><![CDATA[If you are using mysql, you should use locate function instead of patindex]]></description>
		<content:encoded><![CDATA[<p>If you are using mysql, you should use locate function instead of patindex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78804</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 10:54:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78804</guid>
		<description><![CDATA[There may a slight performance difference. Note that patidex is desinged to work in unicode data too]]></description>
		<content:encoded><![CDATA[<p>There may a slight performance difference. Note that patidex is desinged to work in unicode data too</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78803</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 10:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78803</guid>
		<description><![CDATA[Can you post some more sample data with expected result?]]></description>
		<content:encoded><![CDATA[<p>Can you post some more sample data with expected result?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78802</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Jul 2010 10:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78802</guid>
		<description><![CDATA[Refer this post. This will search for a value in all character columns of all the tables and and return column name , table name 
http://beyondrelational.com/blogs/madhivanan/archive/2009/12/14/search-a-value-in-character-column-of-all-tables.aspx]]></description>
		<content:encoded><![CDATA[<p>Refer this post. This will search for a value in all character columns of all the tables and and return column name , table name<br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2009/12/14/search-a-value-in-character-column-of-all-tables.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2009/12/14/search-a-value-in-character-column-of-all-tables.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cristina Gonzalez</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78594</link>
		<dc:creator><![CDATA[Cristina Gonzalez]]></dc:creator>
		<pubDate>Fri, 02 Jul 2010 16:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78594</guid>
		<description><![CDATA[Hello All,

I have a table that contains a field where I store several items, and one of them is an IP address, enclosed in pipes.
Example:

DEVICE IP: &#124;192.168.2.90&#124; Puerto: 1117 01234567890 14142422  Resultado Positivo!

The IP of course is different in lenght for each record; I am using this function:

SELECT id, SUBSTRING(transaccion, CHARINDEX(&#039;&#124;&#039;, transaccion)+1,15) AS ip FROM Mydatabase.dbo.Mytable

But it is extracting another string with a constant lenght.

Is there a way to extract the IP, using a function letting know SQL that the string is enclosed by Pipes?

Thank you all!]]></description>
		<content:encoded><![CDATA[<p>Hello All,</p>
<p>I have a table that contains a field where I store several items, and one of them is an IP address, enclosed in pipes.<br />
Example:</p>
<p>DEVICE IP: |192.168.2.90| Puerto: 1117 01234567890 14142422  Resultado Positivo!</p>
<p>The IP of course is different in lenght for each record; I am using this function:</p>
<p>SELECT id, SUBSTRING(transaccion, CHARINDEX(&#8216;|&#8217;, transaccion)+1,15) AS ip FROM Mydatabase.dbo.Mytable</p>
<p>But it is extracting another string with a constant lenght.</p>
<p>Is there a way to extract the IP, using a function letting know SQL that the string is enclosed by Pipes?</p>
<p>Thank you all!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie Chisholm</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-78191</link>
		<dc:creator><![CDATA[Charlie Chisholm]]></dc:creator>
		<pubDate>Tue, 29 Jun 2010 20:00:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-78191</guid>
		<description><![CDATA[I have a text type column in one of my tables that will contain large amounts of text....25,000 to 40,000 characters.  When I try to use charindex(&#039;fcCount&#039;,data) where data is the column containing the text, it will always return zero, even though,  when I look the data, the &#039;fcCount&#039; is actually there.  This is a SQL 2000 database that we plan to upgrade this year, but need to get this working in the interrum.  Any help would be appriciated.]]></description>
		<content:encoded><![CDATA[<p>I have a text type column in one of my tables that will contain large amounts of text&#8230;.25,000 to 40,000 characters.  When I try to use charindex(&#8216;fcCount&#8217;,data) where data is the column containing the text, it will always return zero, even though,  when I look the data, the &#8216;fcCount&#8217; is actually there.  This is a SQL 2000 database that we plan to upgrade this year, but need to get this working in the interrum.  Any help would be appriciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gshiburaj</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-75203</link>
		<dc:creator><![CDATA[gshiburaj]]></dc:creator>
		<pubDate>Tue, 08 Jun 2010 14:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-75203</guid>
		<description><![CDATA[As a suggestion, you need to work on 

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name = &#039;empid&#039;
ORDER BY schema_name, table_name;]]></description>
		<content:encoded><![CDATA[<p>As a suggestion, you need to work on </p>
<p>SELECT t.name AS table_name,<br />
SCHEMA_NAME(schema_id) AS schema_name,<br />
c.name AS column_name<br />
FROM sys.tables AS t<br />
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID<br />
WHERE c.name = &#8216;empid&#8217;<br />
ORDER BY schema_name, table_name;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K Vamsi</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-65611</link>
		<dc:creator><![CDATA[K Vamsi]]></dc:creator>
		<pubDate>Tue, 20 Apr 2010 06:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-65611</guid>
		<description><![CDATA[declare @string varchar(100)
declare @string1 varchar(100)

set @string = &#039;Peninsula Inv00estment Management Comçagement Comç0estment&#039;
set @string1 = replace(@string, char(231), &#039;&#039;)
select rtrim(@string1)

the output is 
Peninsula Inv00estment Management Comagement Com0estment]]></description>
		<content:encoded><![CDATA[<p>declare @string varchar(100)<br />
declare @string1 varchar(100)</p>
<p>set @string = &#8216;Peninsula Inv00estment Management Comçagement Comç0estment&#8217;<br />
set @string1 = replace(@string, char(231), &#8221;)<br />
select rtrim(@string1)</p>
<p>the output is<br />
Peninsula Inv00estment Management Comagement Com0estment</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/#comment-63768</link>
		<dc:creator><![CDATA[Erik]]></dc:creator>
		<pubDate>Thu, 25 Mar 2010 21:40:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/08/search-text-field-in-sql-server-charindex-vs-patindex/#comment-63768</guid>
		<description><![CDATA[How about another idea? I&#039;m also curious how would doing a CHARINDEX on a field in a record to find 2 characters perform in comparison to using dynamic sql to pull a string out of that same field to do use the IN function?

DECLARE @sql varchar(2000)
SELECT @sql =
(
SELECT
    &#039;(&#039;&#039;&#039; + c1 + &#039;&#039;&#039;)&#039;
FROM
    t_control (NOLOCK)
WHERE
    control_type = &#039;OVERRIDE&#039;
)
SET @sql = &#039;SELECT COUNT(*) WHERE &#039;&#039;XX&#039;&#039; IN &#039; + &#039;&#039; + @sql + &#039;&#039;
SELECT @sql

EXEC (@sql)]]></description>
		<content:encoded><![CDATA[<p>How about another idea? I&#8217;m also curious how would doing a CHARINDEX on a field in a record to find 2 characters perform in comparison to using dynamic sql to pull a string out of that same field to do use the IN function?</p>
<p>DECLARE @sql varchar(2000)<br />
SELECT @sql =<br />
(<br />
SELECT<br />
    &#8216;(&#8221;&#8217; + c1 + &#8221;&#8217;)&#8217;<br />
FROM<br />
    t_control (NOLOCK)<br />
WHERE<br />
    control_type = &#8216;OVERRIDE&#8217;<br />
)<br />
SET @sql = &#8216;SELECT COUNT(*) WHERE &#8221;XX&#8221; IN &#8216; + &#8221; + @sql + &#8221;<br />
SELECT @sql</p>
<p>EXEC (@sql)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

