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
...