That little bit of jiggling seems to have knocked about 10 minutes off, and brought the timing down to around 25 minutes, which is in...
I'd be willing to bet that that line should end vt.vouchercode=vd.vouchercode, in order to get additional details from the "type" table.
Not sure why you are using ISNULL as you are not replacing the NULLs with anything.
AND (@Voucherno is null OR vm.Voucherno=@VoucherNo)
As part of the Transform stage in our DWH I have to create a clinical notes table. We are sent two data extracts which store the actual...
Separate names with a comma.