troubleshooting Question

Merged table ???

Avatar of mooriginal
mooriginalFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft SQL Server 2005SQL
11 Comments1 Solution243 ViewsLast Modified:
I have need to produce a merged table from a table and a spreadsheet
The table that contains all the matches for a package – “ad_group_to_package”
It has a large number of other fields as you can see from the example – spreadsheet attached  - “Decisionmapping _logic”
All fields are nvarchar

We now have a spreadsheet that has been worked on manually – that shows many packages by
Packagename, AD group & the Actual target package that needs to be matched against the ‘packagename’
This is cleaned and more accurate match to the packages found.
The target_package column is definitive as its been manually decided its the best match.

The spreadsheet needs to be matched against the table to find all the packages that match and mark them to use the defined ‘target package’ and not the other versions that maybe in the table under the same group.
The ad group has many occurrences of the package name with all the errors you get with a direct data import.

We need to use the spreadsheet to create a new table that has only the matches between the spreadsheet and table “ad group to package”

I need a complete solution please
The table ad group to package is small as is the spreadsheet,”decisionmapping_logic”

Im open to how it should be done -
I can bulk insert the spreadsheet as tab delimited file into to a table if that helps the merging and joins – so we can assume Decisionmapping_logic could be a raw table.

Final result :
We would be left with a merged table that included all the records from “Ad group to package” table  – but where there were multiple matches for a packagename all point to one correct ‘Target package’
The merged table should have a field that recorded the correct TargetPackage – from decisionMapping_logic
Also if possible it would be useful to have a new flag column introduced that could be marked as true when there are many packages and they have been matched to 1 ‘target package’ in new table.
This column could be called ‘targetPackage_flag’

I  need a complete solution please with all sql working and not just suggestions.
SQL 2005 server version

Thank you very much


Mark Wills
Topic Advisor
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros