Skip to content
Advertisement

T-SQL, looking to extract drug dose from column

I have a column of drug names with dose and I’m trying to extract the just the dose from the field. The difficulty comes in when I have combination drugs that have multiple doses. I can either extract the first numbers in the string, or all of them in one string with no way to separate them.

Desired output

I could deal without the MG in the output, or even have the output be two different columns, but there are cases where drugs have three ingredients.

Advertisement

Answer

This works fine.

This is the hard cording solution. Use it wisely.


Test Result

DB<>Fiddle

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