Skip to content
Advertisement

Parse userid from a text field to a new column

Currently this is what I have and I would want to parse out the userid and add it to the line below it (and before the next line that contains another userid) as a new field.

enter image description here

The result would look like this. Any idea how this would be accomplished in SQl Server?

enter image description here

Advertisement

Answer

Hmmm . . . One method is to use a conditional window function to get the preceding row with '##User: '. Then join back to that row to get the user:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement