I am using sequel server management studio 2014, and I am wondering how I can parse out what is extraneous data for a select query. I do not wish to modify the data, only to grab what I need from it for a SSRS data source, to automate a query. The query would look like what is listed below.
An example of a value in the comments field is listed below 'Based on PO #105680 - Thomas Test GRPO Reciept Validation query test'
Ideally I only want the value '105680' so I can use it as a lookup reference. Any help would be appreciated as always.
SELECT
[DocEntry]
,[DocNum]
,[DocType]
,[CANCELED]
,[Comments]
FROM [Billy].[dbo].[OPDN]
You can use CHARINDEX to find the PO # in the text and then SUBSTRING to parse out the number as long as the format is consistent.
Your query would be something like