Skip to content
Advertisement

Extract first argue from column with T-SQL

I need to extract the first argument: "PATHTOPACKAGE" from the string below:

which is a column stored at SQL Server msdb.sysjobsteps.command

Is there a way to do it by using Regex or Spliting it by blank spaces?

Advertisement

Answer

Based on the one example we have, a couple of CHARINDEXs a little bit of simple string manipulation gets the job done:

If parameters don’t change position, then you can build a more robust solution.

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