Tuesday, March 27, 2012

Comparing table with excel spreadsheet

Hi all,

I have two tables in SQL Server 2005 and excel sheet ( Office 2003).

The colums of excel sheet are: name ,ssn, flagbit ( Note: Excel sheet contains data already)

Columns of table_one and table_two are: name ,ssn

I want to compare the ssn field from table_one and ssn in excelsheet_one, if it matches , then flagbit in excelsheet_one should say"T1".

If i compare ssn field from table_two and ssn in excelsheet_one, if it matches, the flagbit in excelsheet_one should say "T2".

Ex:

Table_one (input) - excelsheet_one ( Output)

ssn name - ssn name flagbit

11 NYC - 11 NYC T1

Both the tables refers same excelsheet_one and have to update the same flag bit column in excelsheet.

Basically, i want to compare table and excel sheet, then if it matches, then update excel sheet.

Does anybody how to do this.

Any help will be greatly appreciated.

Thanks

Export your table to excel and then do the work there.

No comments:

Post a Comment