Hi all,
I have a query which is working fine. However, when I attempt to put it into a view SQL always crashes.
There is no error message when I run the view other than the crash window: SSMS - SQL Server Management has stopped working.
However, if I try save the view, the error message I get is: Attempted to read or write protected memory. This is often and indication that other memory is corrupt.
SELECT MaxDate.LatestUDate, AAA_Tbl_P_M.EndDate, isnull((select 'T' where [LatestUDate]>=[EndDate]),'F')
AS bIsAtOrPastEndDate, AAA_Tbl_P_MU.*
FROM AAA_Tbl_P_M
INNER JOIN ((SELECT P_ID, Max(UDate)
AS LatestUDate
FROM AAA_Tbl_P_MU
GROUP BY P_ID)
AS MaxDate
LEFT JOIN AAA_Tbl_P_MU
ON (MaxDate.LatestUDate = AAA_Tbl_P_MU.UDate)
AND (MaxDate.P_ID = AAA_Tbl_P_MU.P_ID))
ON AAA_Tbl_P_M.ID = MaxDate.P_ID
WHERE AAA_Tbl_P_M.EndDate>Getdate() AND isnull((select 'T' where [LatestUDate]>=[EndDate]),'F')='F'
Why is my SQL studio always crashing when I try to make a view out of this?
And how can I resolve?
Cheers
Addendum: I have found a workable solution in creating the view via a query editor, rather than the designer. Still, I'd rather like to know how to work with the tools without crashing.