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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 split a delimiter column

Author  Topic 

megala
Starting Member

23 Posts

Posted - 2009-04-20 : 22:57:49
Hi, I have a domainname column in mssql 2005 that has date something like 'abc.com'. How can i just extract the name without the domain extension. for example i only need abc

any help is really appreciated. thank you in advance.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-04-20 : 23:01:11
[code]Select Substring(domainname,1,charindex('.',domainname))[/code]
Go to Top of Page

megala
Starting Member

23 Posts

Posted - 2009-04-20 : 23:11:15
Hi sodeep, thanks for the fast reply, the result is get is abc. It has a dot(.). How can i modift it to return without the dot. Thanks again.
Go to Top of Page

megala
Starting Member

23 Posts

Posted - 2009-04-20 : 23:18:18
hi sodeep, i got it. instead of 1 i use Select Substring(domainname,0,charindex('.',domainname)).thanks alot
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-21 : 00:45:05
SELECT PARSENAME(DomainName, 2)
FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

megala
Starting Member

23 Posts

Posted - 2009-04-21 : 00:59:33
Hi Peso, thanks..that worked great as well..thanks guys.
Go to Top of Page
   

- Advertisement -