
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2021 04:00 PM
Hi,
Is there a way in SQL to select certain values from a Description column and display just those values in a new column or the same Column, for example I have a table containing CVE information, I'm trying to just identify the CVE Values so this :
"Microsoft Windows Multiple Type1 Font Parsing Remote Code Execution Vulnerabilities (CVE-2020-1020 and CVE-2020-0938)"
Becomes :
"CVE-2020-1020,CVE-2020-0938"
Cheers
A
Is there a way in SQL to select certain values from a Description column and display just those values in a new column or the same Column, for example I have a table containing CVE information, I'm trying to just identify the CVE Values so this :
"Microsoft Windows Multiple Type1 Font Parsing Remote Code Execution Vulnerabilities (CVE-2020-1020 and CVE-2020-0938)"
Becomes :
"CVE-2020-1020,CVE-2020-0938"
Cheers
A
Labels:
- Labels:
-
Report Center
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2021 11:12 AM
Hi Hendrik.VE,
That was really helpful and I'm nearly there with your help, the query I have so far is
The only issue I am getting a few records which have text before as below, which I cant seem to remove the text before?
OLE Automation Underflow Vulnerability CVE-2011-0658
Null Session Cookie Crash Vulnerability CVE 2011-2012
CVE-2021-40730
CVE-2021-40493
CVE-2021-40486
Cheers
A
That was really helpful and I'm nearly there with your help, the query I have so far is
SELECT Name,(SELECT REPLACE(REPLACE(SUBSTRING(dbo.[DB].Name, CHARINDEX('(CVE-', dbo.[DB].Name), CHARINDEX(')', dbo.[DB].Name)), '(', ''), ')', '') AS Expr1) AS CVE
FROM dbo.[DB]
The only issue I am getting a few records which have text before as below, which I cant seem to remove the text before?
OLE Automation Underflow Vulnerability CVE-2011-0658
Null Session Cookie Crash Vulnerability CVE 2011-2012
CVE-2021-40730
CVE-2021-40493
CVE-2021-40486
Cheers
A

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2021 04:30 PM
Hi Andy,
should be quite easy to implement using a combination of substring and charindex calculations in SQL.
So something like
Select
Substring( tblBlabla.description, charindex('(CVE',tblBlabla.description), charindex (')',tblBlabla.description ) )
But a little bit more complicated like that 🙂
A bit of trial and error and it should work.
Oh and a 'replace' to replace the AND with ,
should be quite easy to implement using a combination of substring and charindex calculations in SQL.
So something like
Select
Substring( tblBlabla.description, charindex('(CVE',tblBlabla.description), charindex (')',tblBlabla.description ) )
But a little bit more complicated like that 🙂
A bit of trial and error and it should work.
Oh and a 'replace' to replace the AND with ,
