Parsing text

  • I am looking to find a way to parse a parameter value from a procedure query, taking the query in as text.

    For example, I am returning a list of all the steps accessioned with a job.  The job command looks like 'exec msdb.dbo.[procedure] @PATH='[backupServer]', @Retry=0'.  I am retrieving that text from the command column in the sysjobssteps table.  I would like to parse that value to only display the text inside the @Path parameter definition.  Like I would like the query to only return [backupServer] instead of the entire command.

    Is there a simple way to do this without using the PATINDEX function with RIGHT and LEFT?  It seems really ugly to me for a simple task.

    Any Ideas?

     

    -Andrew

  • No, you would need to use patindex/charindex to get the positions and then substring to find the data. You are dealing with a string here, not a function call or a procedure call, so you would need string manipulation

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply