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 2008 Forums
 Transact-SQL (2008)
 [RESOLVED] parse string

Author  Topic 

HenryFulmer
Posting Yak Master

110 Posts

Posted - 2011-07-28 : 16:46:10
I have a field VARCHAR(100)
with Textdata in it followed by a numeric value in paranthesis.
I'd like to strip out everything from the open paran on.
Any advise?

Thanks.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-07-28 : 16:54:50
declare @str varchar(100)
set @str = 'abcdef(123)'

select substring(@str, 1, charindex('(', @str)-1)
Go to Top of Page

HenryFulmer
Posting Yak Master

110 Posts

Posted - 2011-07-28 : 17:01:25
great - thank you.
Go to Top of Page
   

- Advertisement -