Thanks for posting the link. I can safely eliminate any of the .Net-related causes because I have this issue simply running the query in management studio. All I know is that switching from an INNER join to a LEFT join seems to make a difference. I assume this means different query plans are being generated, but I can't even see an estimated query plan for the inner join because the same error comes up when I ask for one.
UPDATE: We have a filtered index on the fact table. I disabled the index and now the query runs using the INNER join too. Here is the code for the index:
/****** Object: Index [idx_fctSwapDualShift_ValueAggregation] Script Date: 03/15/2013 12:34:24 ******/
CREATE NONCLUSTERED INDEX [idx_fctSwapDualShift_ValueAggregation] ON [Reporting].[fctSwapDualShift]
(
[ValuationDateID] ASC,
[BookID] ASC,
[HiPortNameID] ASC,
[ContractTypeID] ASC,
[TypeID] ASC,
[ManagerID] ASC,
[ParallelShiftID] ASC,
[SwapTenorID] ASC,
[ClientID] ASC
)
INCLUDE ( [Value])
WHERE ([Value]<>(0))
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
Any ideas why this makes a difference?