0

Suppose I have two tables:

Table1: Pets
PetID----------|Name----------|Type----------|
1              |Shaz          |Dog           |
2              |Molly         |Cat           |
3              |K9            |Dog           |
4              |Billy         |Goat          |
______________________________________________

Table 2:PetAttributes
PetID----------|AttributeName-|AttributeValue|
1              |HairColor     |Black         |
1              |Breed         |GermanShepherd|
1              |Age           |12            |
______________________________________________

As you can see from the sample, the pet attribute is linked to the PetId in the first table. For each pet, there are actually 28 attributenames each with a attributevalue. I need a faster and more efficient way of a)Inserting a new pet in the first table AND b) assigning their attributes in the second table. I'm often inserting 10-15 new pets at a time, making it incredibly tedious and mistake-prone activity when I'm writing up my SQL codes.

If anyone could help me, I'd be greatly appreciative.

Thanks in advance

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by debasisdas
0

Why not create insert script using some tool (best in EXCEL) and insert the parent record and then the dependent child record.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.