declare @Sample table (Proj_name varchar(100))
insert @Sample select '123.234.martiinternational.pdf' union all
select '22356.2894.martiinternational.pdf' union all
select '6758.1287.papa.pdf'
SELECT * ,
STUFF(LEFT(Proj_name,CHARINDEX('-',Proj_name+'-')-1),1,CHARINDEX('.',Proj_name+'.'),'')
FROM @sample;
the above select i used when the string is like this:
'123.234-martiinternational.pdf' getting second set between dot and hyphen which is 234.
Now i have same string with dot instead of hyphen.
'123.234.martiinternational.pdf'
Has almost 40k strings, that i would liek to extract just the second set id number.