I have a column with some single values and comma separated values and I want to replace them by matching to a description table.
I have a table that looks like this:
Text representation:
Length Directory Extensions Extension Description Type
6684672 Y:\Data\Retail\WalmartMX\Development\Curt.Wolfe\ChristiesAnalysisTool accdb accdb Access Database Development/DB
2002944 Y:\Data\Retail\WalmartMX\Development\SourceCode\WalmartMxDecipher\APPS ACCDB accdb Access Database Development/DB
5312512 Y:\Data\Retail\WalmartMX\Development\SourceCode\AnalysisTool accdb accdb Access Database Development/DB
30986240 Y:\Data\Retail\WalmartMX\Utilities\Tracking\Stats\BAK accdb accdb Access Database Development/DB
112917071 Y:\Data\Retail\WalmartMX\Deploy\Development\SourceCode\WalmartMxDecipher accdb,accde,zip NULL NULL NULL
139053182 Y:\Data\Retail\BQ\Utilities\EMT accdb,bat,docx,laccdb,txt NULL NULL NULL
32116006 Y:\Data\Retail\WalmartMX\Utilities\Tracking\Stats accdb,bat,laccdb,sql,xlsx NULL NULL NULL
I need to replace the values in the extension field or better yet create a new field that has the listings with description from another table.
- Match on extension (could be comma separated need them all)
- Provide a new field with the description
a. New field should (if extension is accdb) be Access Database (Match from another table)
b. If there is csv it should read (if extensions are txt,xml) CSV File, TextFile (again match from another table on the extension field)
Code so far:
SELECT *
FROM [SandboxVinny].[dbo].[FinalDirectoryListing] FDL
left JOIN dbo.SourceExtensions SE
on SE.Extension = FDL.Extensions
Obviously using this I get null values for any row that has multiple file extensions in the field.