November 30, 2019 at 2:53 am
Hi All
I have two tables=
Master table
id_master, int, Autoincremental
detail_table
id_master
id_detail,int Autoincremental
My question is, in the detail table, how create a table that the id_detail start in 1, when a id_master is new?
Example
Master_table
id_master
1
2
3
detail_table
id_master id_detail
1 1
1 2
1 3
2 1
2 2
3 1
How do I do it every time a new id is added in the "master" start of 1 in the "detail"?
November 30, 2019 at 6:33 pm
Do you want a stored proc to do this?
Are all of the detail rows created at the same time as the parent?
What is the PK of the detail table?
December 1, 2019 at 2:52 pm
PLEASE don't duplicate posts. All does is split up the answers others make.
Please, no more answers on this thread folks. Instead, post them on the following thread.
https://www.sqlservercentral.com/forums/topic/master-and-detail-table
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply