Dear All,
I have a query which brings the results of Financial Account Statement. I need to create this as a View.The Query is giving me perfect results!. But When I convert it into View,its showing the error,
"SQL text cannot be represented in the grid pane and diagram pane.". I ignored it and created the view . Its showing the results correctly. This View has to integrated with a third party DB (linked server), say MySQL. If I ignore this warning and proceed , will that cause any issues in viewing the results in third party DB.
Please see the below View that is created for this purpose. Can anyone suggest what part of the query is causing this issue?
SELECT MainQuery.Code, mainquery.Description, MainQuery.CompanyCode, MainQuery.BusinessUnitCategory, mainquery.CalendarYTDDebit, CalendarYTDCredit
FROM (SELECT DISTINCT
gl.code, fp.Description, gp.fCompanyCode AS CompanyCode, bu.fTableField1Code AS BusinessUnitCategory, gp.fbusinessunitcode, CalendarYTDDebit = sum(gp.debitvalue)
OVER (Partition BY gl.code, gp.fcompanycode, gp.fbusinessunitcode, Year(fp.enddate)
ORDER BY fp.enddate), CalendarYTDCredit = sum(gp.CreditValue) OVER (Partition BY gl.code, gp.fcompanycode, gp.fbusinessunitcode, Year(fp.enddate)
ORDER BY fp.enddate)
FROM ESGLAccountPeriodics gp LEFT JOIN
ESGOFiscalPeriod fp ON fp.gid = gp.fFiscalPeriodGID LEFT JOIN
ESGOFiscalYear fy ON fy.gid = gp.fFiscalYearGID LEFT JOIN
esglaccount gl ON gl.gid = gp.fAccountGID LEFT JOIN
ESGOZBusinessUnit bu ON bu.Code = gp.fBusinessUnitCode
WHERE gl.ChartOfAccounts = 0 AND year(fy.BeginDate) = year(getdate()) AND gl.FlagField2 = 1
GROUP BY gl.code, fp.Description, fp.EndDate, gp.DebitValue, gp.CreditValue, gp.fCompanyCode, bu.fTableField1Code, gp.fBusinessUnitCode
UNION
SELECT DISTINCT gl.code, fp.Description, '' AS CompanyCode, '' AS BusinessUnitCategory, '' AS fbusinessunitcode, CalendarYTDDebit = sum(gp.debitvalue) OVER (Partition BY gl.code, Year(fp.enddate)
ORDER BY fp.enddate), CalendarYTDCredit = sum(gp.CreditValue) OVER (Partition BY gl.code, Year(fp.enddate)
ORDER BY fp.enddate)
FROM ESGLAccountPeriodics gp LEFT JOIN
ESGOFiscalPeriod fp ON fp.gid = gp.fFiscalPeriodGID LEFT JOIN
ESGOFiscalYear fy ON fy.gid = gp.fFiscalYearGID LEFT JOIN
esglaccount gl ON gl.gid = gp.fAccountGID
WHERE gl.ChartOfAccounts = 0 AND year(fy.BeginDate) = year(getdate()) AND gl.FlagField2 = 0
GROUP BY gl.code, fp.Description, fp.EndDate, gp.DebitValue, gp.CreditValue) MainQuery
Thanks in Advance to all!!