Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
azwiefel
Starting Member
7 Posts |
Posted - 2003-08-19 : 07:42:11
|
HELP! Heres the situation:I have to populate a summary table from 3 other tables. 2 of the tables have mulitple records that need to be moved, both with Multipul primary keys.Table 1 consists of labels, each roll is assigned to an employee, the label type is defined by the SITE IDTable 3 consists of a machine, this machine has counters of which one is assigned to a label type. These relationships are defined in Table 2Table 4 is an order table which defines the order number in which each record in the "NEW" table is releated Example:Table 1: siteID LabelID EmployeeID ->LabelType FK|StartNumber ||Table 2: |SiteID PK ->LabelType PK ->CounterType PK||Table 3:|SiteID|EquipmentID PK ->CounterTypePK StartNumber Table 4 (Order Table) Order Number (auto INcreament) SiteIDNEW TABLEORDER NUMBERLabelIDLabelTypeStartNumberEquipmentIDCounterTypeEquipmentStartNumberThere always will be several records from Table 1 and 2 that need to be inserted into the "NEW" table with the ORDER NUMBER from Table 4.OK, I'd prefer to do this in a Stored procedure because of error trapping... Is there a quicker way to do this?either way would someone get me pointed down the right coding path.....THANKS |
|
|
|
|
|