Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad Design - Combine Tables with Insert

Status
Not open for further replies.

JurkMonkey

Programmer
Nov 23, 2004
1,731
CA
Hey,

I have 2 tables that have an ID and a string with different names.

Table1: CatID CatName
Table2: BirdID BirdName


I need a way to query both of these items together into one dataset. Then I need to be able to call an insert using that same dataset.

Any ideas how to do this - or how to get around it?

Thanks!
 
You want an union query ?
SELECT CatID ID, CatName PetName FROM Table1
UNION ALL SELECT BirdID, BirdName FROM Table2

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That does put all the items into a single list - which is great.

The issue was inserting back into the table via C# DataSets. It tries to dynamically create the query but doesn't support UNION queries. I was hoping to manually build the insert and update commands.

I got around this by simply adding a separate control and splitting the queries up.

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top