-2

I have 10 tables from different sources that I import into a SQL Server database. I want to compare them with a table named basic_source. What I want to do is compare each attribute in basic_source with each attribute in the other 10 tables, one at each time. If the two attributes have same name, then look at their values (which should be distinct value). Then, extract the values to an array. The logic I'm looking for is below

Tables{ table1, table2, table3,………., table10}

If (columni name from basic_table = columnj name from table1)

//Extract data from columnj to an array columnj_value[]=("select distinct (columnej) from table1")

Next columni from basic_table , Next attributej from table1 Next table

1 Answers1

1

From what I understand of your question, you could possibly use a Dictionary<string, object> to represent the column names and values in your table. For example, you would store a Dictionary<string, object> object for each table, then when comparing, you could do a look up inside the KeyValuePair objects in each Dictionary, looking for relevant matches.

Samuel Slade
  • 8,405
  • 6
  • 33
  • 55