﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / create function / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 11:07:14 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: create function</title><link>http://www.sqlservercentral.com/Forums/Topic988002-146-1.aspx</link><description>thank you very much</description><pubDate>Fri, 17 Sep 2010 04:00:56 GMT</pubDate><dc:creator>river1</dc:creator></item><item><title>RE: create function</title><link>http://www.sqlservercentral.com/Forums/Topic988002-146-1.aspx</link><description>Use this:[code="sql"]Select CHARINDEX('*',@InputString,CHARINDEX('*',@InputString, 1) + 1)[/code]Returns 0 if it doesn't find a second '*'.edit: too late :(</description><pubDate>Fri, 17 Sep 2010 03:19:38 GMT</pubDate><dc:creator>Oliiii</dc:creator></item><item><title>RE: create function</title><link>http://www.sqlservercentral.com/Forums/Topic988002-146-1.aspx</link><description>[code="sql"]IF LEN(@string) - LEN(REPLACE(@string, '*', '')) &amp;gt;= 2BEGIN	RETURN LEN(@string) - CHARINDEX('*', REVERSE(@string)) + 1END[/code]</description><pubDate>Fri, 17 Sep 2010 03:19:13 GMT</pubDate><dc:creator>hallidayd</dc:creator></item><item><title>RE: create function</title><link>http://www.sqlservercentral.com/Forums/Topic988002-146-1.aspx</link><description>[code]declare @SearchString varchar(100)set @SearchString = '*411221211*222'select charindex('*',@SearchString,CHARINDEX('*',@SearchString,1)+1)[/code]</description><pubDate>Fri, 17 Sep 2010 03:17:55 GMT</pubDate><dc:creator>steveb. </dc:creator></item><item><title>create function</title><link>http://www.sqlservercentral.com/Forums/Topic988002-146-1.aspx</link><description>HI,   I need to create a function that receives a parameter (string) and returns a value if there is a second '*' in the string.E.g:   Function receives the string:                                 *4112*21211222    returns number 6Other e.g     Function receives the string:                                 *411221211*222    returns number 11Other e.g     Function receives the string:                                 411221211222    returns nothing, because there is no second *Can someone help me with the t-sql to do this?Thnak you</description><pubDate>Fri, 17 Sep 2010 03:05:25 GMT</pubDate><dc:creator>river1</dc:creator></item></channel></rss>