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)
 retrieve string

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-07-01 : 05:47:56
Hi, how to retrieve only string between two character "(" and ")"


SELECT Title FROM tbl_book


result :
book (xyz)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 05:51:33
[code]substring(title, charindex('(', title) + 1, charindex(')', title) - charindex('(', title) - 1)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-07-01 : 06:53:30
quote:
Originally posted by khtan

substring(title, charindex('(', title) + 1, charindex(')', title) - charindex('(', title) - 1)



KH
[spoiler]Time is always against us[/spoiler]




Thanks.
Go to Top of Page
   

- Advertisement -