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.
Author |
Topic |
ccrespo
Yak Posting Veteran
59 Posts |
Posted - 2007-07-19 : 17:16:13
|
I have a field that's formatted like 'Program Name (User)', the user field changes with the corresponding username, can I select just whats in the parentheses? |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-19 : 17:21:52
|
[code]declare @b varchar(50)select @b = 'Program Name (User)'select @b, replace(replace(@b, ')', ''), 'Program Name (', '')[/code]_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-19 : 17:25:38
|
Sample: declare @t varchar(50)Set @t = 'Program Name (User)'select substring(@t, charindex('(' ,@t) + 1, len(@t)-charindex('(' ,@t) -1 ) Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-19 : 18:47:58
|
I think the "Program name" changes for every program the user attends or uses declare @s varchar(500)set @s = 'Program Name (User)'select replace(parsename(replace(@s, '(', '.'), 1), ')', '')Peter LarssonHelsingborg, Sweden |
 |
|
ccrespo
Yak Posting Veteran
59 Posts |
Posted - 2007-07-20 : 07:46:14
|
those work THANKS!!! |
 |
|
|
|
|
|
|