needed data extraction Logic

  • I have 1000s number policy number list(this is not a table just a excel file that contains the policy number) that contains policynumber

    and there is a table ABC contains all the available policy information based

    on policy number, my requirement is that i need to findout

    all those policy number that are not existing in the table ABC.

  • Well, reading excel data from within T-SQL requires many security related permissions such as enabling OPENROWSET configurations, read access to file etc..

    So, my suggestion is to first import the excel data into a temporary table and then query that table for the required information, for. e.g.

    SELECT *

    FROM dbo.ExcelPolicies

    WHERE PolicyNumber NOT IN( SELECT PolicyNumber FROM dbo.DBPolicies )

    --Ramesh


  • You could also use SSIS to read the excel file and use a lookup component to compare to the policy numbers and output the missing numbers to a table or text file.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

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

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