February 3, 2014 at 5:03 am
Hi All,
I have a field that contains some names and would want to lift the name part that I want from the field. For example the field when run when will give "ACCOUNTANTS:- Signal Chartered Accountants @@ Individual:Mark John-Wilkinson" . So I need an expresssion that will give me Signal Chartered Accountants @@.
Please there are other names in the field so I would need a generic expression that can lift such names from the field irrespective of the name.
The task that I have is to be done with SSRS expressions only and not with SQL.
EO
February 3, 2014 at 9:26 pm
Something like....
DECLARE @TextString VARCHAR(100) = 'ACCOUNTANTS:- Signal Chartered Accountants @@ Individual:Mark John-Wilkinson';
DECLARE @StartPos INT,
@EndPos INT;
SELECT @EndPos = CHARINDEX('@@',@TextString);
SELECT @StartPos = CHARINDEX(':-',@TextString)+2;
PRINT @StartPos;
PRINT @EndPos;
SELECT RTRIM(LTRIM(SUBSTRING(@TextString,@StartPos,@EndPos-@StartPos)));
Returns:Signal Chartered Accountants
You should be able to use the expression in SSRS... or did you want to do it in VB.NET?
February 7, 2014 at 10:20 am
Thanks Pietlinden. Yes I was referring on how to do it in VB.net expressions although your SQL is so useful.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply