July 30, 2013 at 10:15 am
Hi geniuses,
consider:
create table #mytable
(
Value varchar(50)
)
INSERT INTO #mytable
(Value)
SELECT 'First.Second'
I need to isolate what's before the symbol: '.'
I was able to catch whats after the symbol:
SELECT
Value,
(substring(Value,charindex('.',Value)+1,LEN(Value))) AS 'beforedot'
FROM #mytable
Thanks in advance!
July 30, 2013 at 10:18 am
You mean this?
LEFT(Value,charindex('.',Value)-1)
July 30, 2013 at 10:20 am
Luis Cazares (7/30/2013)
You mean this?
LEFT(Value,charindex('.',Value)-1)
Exactly!
Thanks buddy!
August 1, 2013 at 11:56 am
Need to adapt to this:
(substring(Value,charindex('.',Value)+1,LEN(Value)))
in order o get what's before the 'dot'.
Thnaks
August 1, 2013 at 12:25 pm
August 1, 2013 at 12:49 pm
You could also use PARSENAME for this.
select PARSENAME(Value, 2) as FirstPart, PARSENAME(Value, 1) as SecondPart
from #mytable
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply