Looking for some ideas.
I'm running SQL Server 2014. I have a varchar(500) column that has a data value that I need to extract from each row, however, it is not always in the same position on the row (sometimes off by 1 or 2 positions) so I'm having difficulty with the substring:
substring(Failure_Reason, charindex('Pressure received:', Failure_Reason + 181, 5) as 'Test'
Using this line of code, most of the time I get the correct data value, however sometimes I get a value like '67.T'
The varchar column's content is:
Settings received from Creep tester are outside expected values for pouch 3. Pressure Duration received : 0. This value should be 32 +/- 2. Pressure received : 198.5. This value should be between 202.77 and 197.24..
The verbage is always the same but the data values would be different
I'm just trying to parse out the value after the "Pressure Received:" but as it may be a position or two off in certain rows, I sometimes pull in the "." or the "T", is there a way to catch the value between the "Pressure Received:" and the "This", so I only get the numeric value?
Thanks!
The following should show you how to approach this: