• wendy we need some examples, i think;

    splitting the name based on some character is easy; PARSENAME or the famous DelimitedSplit8K are two examples that come to mind;

    but unless there is a naming convention, ie the first x segments constitute the company name, i don't know what i can offer.

    With MySampleData(filename)

    AS

    (

    SELECT 'wendy-elizabeth-inc-2013-01-04.txt' UNION ALL

    SELECT 'lowell_Corporation.txt' UNION ALL

    SELECT 'dwainc-LLC-LatestExport.txt'

    )

    SELECT

    myfn.*,

    MySampleData.*

    FROM MySampleData

    CROSS APPLY dbo.DelimitedSplit8K(REPLACE(filename,'_','-'),'-') myfn

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!