I have a table with a column with these example values
| Commands |
| ------------ |
| SELECT - #TRAPAY# |
| SELECT - #OSTLIA# |
| SELECT ISNULL(CONVERT(VARCHAR(50), #OPCASH# + #ACCREC# + #INVENT# + #OCASS# + #TRAPAY_N# + #OSTLIA_N#), '-') |
| SELECT #GTFA# |
| SELECT #ACCDEP# |
And I need to extract all the words between the #. Is it possible?
I have tried using SUBSTRING but not all the words have the exact same length.
2条答案
按热度按时间crcmnpdw1#
You may create a function like this:
odopli942#
Use Replace Function to populate only text in between the #
You one String which contains multiple #. If you want in between words in separate rows, then Use STRING_SPLIT
Below pasted both outputs
fiddle