473,414 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

One Record from many tables

Hello folks. I have a question regarding a database i am working with. I am no expert on the MSSQL server nor any other really i guess...but i do know some SQL, and i have been trying to find a solution to my problem on MSSQL to have little luck.

Here is my situation:

We have flat files of data that are downloaded once per day. These files are imported Via BCP into some holding tables. We then have a "Translation" database that holds all the core information our "Cart" database requires. I am in the process of writing a series of SQL strings that will load data from the various imported tables into the translation database.

The specific part that is giving me a problem, is the one set of flat files is organized by Manufacture. 3com for example... Each of these tables has a field in it that specifies the manufacture also.

We have in the translation database a list of categories, my goal is to take each of the manufactures from the tables and add them as a category.

So, as far as i can tell what i need to do is this:

Get a List of all tables in <parts> database
Get 1 record (any record) form each table "SELECT TOP 1 [manufacture] from <parts>"
Insert the value of Manufacture to the categories database

Thats about it. This will probably require some kind of loop, i think it was a counter i saw? My main issue has been getting a list of tables (only the product tables) from the database. It only has part tables that i have made... i don't know if it has any system tables build into the database though.

Hope someone can give me some ideas here! Thanks guys & girls.


--Dave
Nov 22 '06 #1
1 1591
willakawill
1,646 1GB
Hello folks. I have a question regarding a database i am working with. I am no expert on the MSSQL server nor any other really i guess...but i do know some SQL, and i have been trying to find a solution to my problem on MSSQL to have little luck.

Here is my situation:

We have flat files of data that are downloaded once per day. These files are imported Via BCP into some holding tables. We then have a "Translation" database that holds all the core information our "Cart" database requires. I am in the process of writing a series of SQL strings that will load data from the various imported tables into the translation database.

The specific part that is giving me a problem, is the one set of flat files is organized by Manufacture. 3com for example... Each of these tables has a field in it that specifies the manufacture also.

We have in the translation database a list of categories, my goal is to take each of the manufactures from the tables and add them as a category.

So, as far as i can tell what i need to do is this:

Get a List of all tables in <parts> database
Get 1 record (any record) form each table "SELECT TOP 1 [manufacture] from <parts>"
Insert the value of Manufacture to the categories database

Thats about it. This will probably require some kind of loop, i think it was a counter i saw? My main issue has been getting a list of tables (only the product tables) from the database. It only has part tables that i have made... i don't know if it has any system tables build into the database though.

Hope someone can give me some ideas here! Thanks guys & girls.


--Dave
Hi. The way you have described it sounds like this will do the job
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO categories
  2. SELECT DISTINCT Manufacturer
  3. FROM Parts
  4.  
Nov 22 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one...
7
by: Ilan Sebba | last post by:
I am trying to add a record using SQL. My problem is that the primary keys are foreign keys, and these foreign keys are autonumbers. I therefore do not know the primary keys of the record I am...
6
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables....
0
by: Arnold | last post by:
Hi there, I have a form to organize bottles in mind, but am unsure if it will work. Here's some background info: Mainform = frmProduct, which contains fields for pricing, status, etc. of...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
4
by: S. Graefner | last post by:
I have been unable to locate anywhere the answer to my problem. I would like to be able to download/import a single record. This record is stored in many different related (one to one) tables. I...
1
by: Stewart Graefner | last post by:
I have been unable to locate anywhere the answer to my problem. I would like to be able to download/import a single record. This record is stored in many different related (one to one) tables. I...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
14
by: David Garamond | last post by:
begin; update t set val=val+1; -- 1000 times commit; How many record versions does it create? 1 or 1000? I'm implementing a banner counter which is incremented at least 2-3 millions a day. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.