File Comparison

  • I have two files one universe u1 and a bad file b1.I have to create a new file n1 by excluding the bad records from the universe .

    N1 should be u1 - b1 .How could we achieve this in SQLSERVER.

     

     

  • By using LEFT JOIN and check for NULL values in column.

    And query the files with OPENROWSET function.

    Sorry I can't help you more, but if you provide us some sample data from the files, we may be able to help you.

    How do you for example compare rows?


    N 56°04'39.16"
    E 12°55'05.25"

  • Hi Peter,

          I am very new to DTS.This validation has to be done in DTS preprocessor.So I was thinking of something like  importing these 2 files  u1 and b1 in a two tables and then use EXISTS condition to find the difference between two tables and give out the result in a new file.Would this be possible? or Is therea easy way in DTS to find the difference between two files.

    Thanks,Abhirami.

  • Yes, there are easy ways.

    Let us know what the files look like and how you compare two rows.


    N 56°04'39.16"
    E 12°55'05.25"

  • It would basically work something like this...

    SELECT U1.*
    INTO N1
    FROM U1
                LEFT OUTER JOIN B1 ON U1.field = B1.field
    WHERE B1.field IS NULL
     
    ("field" being the common column that is being joined on)
     
    This will give you everything in the Universe table that is not in the Bad table.
     
    Good luck.
     
    Okafor

Viewing 5 posts - 1 through 4 (of 4 total)

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