Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Substr Lesson

Author  Topic 

nuruddean
Starting Member

11 Posts

Posted - 2010-08-04 : 01:04:09
how i want to do substr this :
Head.165-Matriculation Centre

i just want to get 'Head' or any word before the first "."

My Name is Nuruddin

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-04 : 01:43:20
give clarity to your need

With Regards
Kashyap M
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-08-04 : 01:45:45
declare @s varchar(255)
set @s = 'Head.165-Matriculation Centre'


Select case when charindex('.',@S) > 0 then left(@s, charindex('.',@S) -1 ) else @s end

I am here to learn from Masters and help new bees in learning.
Go to Top of Page
   

- Advertisement -