I am writing a T-SQL function that returns an account number from a block of text. The text is generated by the system, and has 3 colons so I need to try to find a way to use SUBSTR() on the row containing "Account:" and not just the colon itself:
Amount: $10.00
Date: 12/5/2022
Account: Mr. John Doe 83850
What would be the cleanest way to select only the line containing the account number to my function for parsing into an integer?
CodePudding user response:
I'll probably mess this up on my phone but something like this should help:
SUBSTRING(TEXT,(PATINDEX('