我需要为5个以上的表生成报告,数据源是我使用数据库中的查询生成的xml文件。现在我已经用一张小桌子和相对较少的子桌子完成了这个,但是找到所有关系需要很长时间。我用了这段代码:
select *,
(select *,
(select * from PostalCode where PostalCode.PostalCodeNumber = Customer.PostalCodeNumber for xml path ('PostalCode'), type),
(select * from Province where Province.ProvinceCode = Customer.ProvinceCode for xml path ('Province'), type),
(select * from Land where Land.LandCode = Customer.LandCode for xml path ('Land'), type)
from Customer where Customer.CustomerNumber = SampleRequest.CustomerNumber for xml path ('Customer'), type),
(select *,
(select * from Article where Article.ArticleNumber = SampleRequestLine.ArticleNumber for xml path ('Article'), type)
from SampleRequestLine where SampleRequestLine.RequestNumber = SampleRequest.RequestNumber for xml path ('SampleRequestLine'), type),
(select * from Firm where Firm.FirmCode = SampleRequest.FirmCode for xml path ('Firm'), type),
(select * from CustomerDeliveryAddress where CustomerDeliveryAddress.DeliveryAddressCode = SampleRequest.DeliveryAddressCode for xml path ('DeliveryAddress'), type)
from SampleRequest
for xml path ('SampleRequest'), root ('SampleRequests')
现在我的问题是:导出具有所有子表的特定表的时间是否较少? (也许通过使用某种软件?)