I was able to write a recursive logic in c# and because of performance issue I need to write this in Stored Proc or UDF in SQL Server. I have following tables and I would appreciate if any one can suggest me how to do something like this
Table EQ- ID, Name, SYSID (nullable)
Table RD - ID, Name
Table EQ_RD_Xref - EQ_RD_XrefID, EQID, RDID (EQ and RD have many to many relationship)
Table SMAST - MASTERID, MasterName
Table EQ_SMAST_XREF - EQ_SMAST_XREF,M ASTERID,EQID
Table SYS - SYSID, SYSName
Whenever I want to get the dependencies for EQ BY ID it should give me entire forest of EQ's (tied to EQ_SMAST_XREF and these EQ's may have SYS or other RD's), RD's (these RD's may have some other EQ's) and Sys. The forest should have only the items in the forest and not any other item
Thanks for any help in advance
Table EQ- ID, Name, SYSID (nullable)
Table RD - ID, Name
Table EQ_RD_Xref - EQ_RD_XrefID, EQID, RDID (EQ and RD have many to many relationship)
Table SMAST - MASTERID, MasterName
Table EQ_SMAST_XREF - EQ_SMAST_XREF,M ASTERID,EQID
Table SYS - SYSID, SYSName
Whenever I want to get the dependencies for EQ BY ID it should give me entire forest of EQ's (tied to EQ_SMAST_XREF and these EQ's may have SYS or other RD's), RD's (these RD's may have some other EQ's) and Sys. The forest should have only the items in the forest and not any other item
Thanks for any help in advance
Comment