Hi All,
Thanks for some of the solutions, I've tried a few.
SELECT SUBSTRING(@var,28+CHARINDEX ('CustomerFornm: Changed from ',@var),CHARINDEX('CustomerDOB',@var)- CHARINDEX ('CustomerFornm: Changed from ',@var)-28) AS 'Is this really what you
want?'
Doesn't work as it requires me to feed in a variable, @var. My SQL has to be in a view. I don't have a choice on the matter due to how the 3rd party software works. CustomerDOB will not always follow, it may not even exist and there are a whole load of other 'Changed From' categories that can be present. For example 'NI: Changed from '
Essentially it is variable all the time.
The datatype is varchar and we have SQL server 2008, applologies as this may be a SQL server 2000 forum I had not realised.
I have created a function that loops through each character in the string but this seems a very inefficient way of trying to achieve my result.
Thanks for the help and replies so far.
Eliza