Home > database >  Circulation function call and write to the temporary table
Circulation function call and write to the temporary table

Time:11-15

The CREATE TABLE [dbo] [Data0025] (
RKEY (int) NOT NULL,
[MANU_PART_NUMBER] [varchar] (20) NULL,

[PARENT_PTR] [int] NULL,
)
Select * from [Data0025]

Insert into Data0025 (RKEY, MANU_PART_NUMBER PARENT_PTR)
Values (26949, 'l1 - l8, 0),
(26950, 'BMD at l1-l4, 26949),
(26951, 'l5 - l8, 26949),
(26952, 'l1 and l2, 26950),
(26953, 'l3 - l4, 26950),
(26954, l5, l6, 26951),
(26955, 'about the - l8, 26951),
(36949, 'l1 - l6, 0),
(36950, 'l2 - l5, 36949),
(36951, 'l3 - l4, 36950)
A temporary table # T, existing storage data
The CREATE TABLE # T (
RKEY (int) NOT NULL,
[MANU_PART_NUMBER] [varchar] (20) NULL,
[PARENT_PTR] [int] NULL,
)

Insert into # T (RKEY, MANU_PART_NUMBER PARENT_PTR)
Values
(26955, 'about the - l8, 26951),
(36951, 'l3 - l4, 36950)
Want to according to the data in the temporary table # T, query the all superior data and write to the temporary table # TT
Query data is as follows:
26949, 'l1 - l8, 0
26951, 'l5 - l8, 26949
36949, 'l1 - l6, 0
36950, 'l2 - l5, 36949
  • Related