运行此SQL查询时出现500错误

时间:2013-04-24 17:58:55

标签: sql-server sql-server-2008 coldfusion

它真的很奇怪它在一天的日期范围内工作但过去我得到500服务器错误。该查询在管理工作室中运行良好。

SELECT tblCAPMessages.*, tblCADSNotes.Notes 
FROM tblCAPMessages 
  LEFT JOIN tblCADSNotes ON tblCAPMessages.Identifier = tblCADSNotes.Identifier 
WHERE tblCAPMessages.MsgSent BETWEEN {ts '2013-04-23 10:15:00'} AND {ts '2013-04-23 11:15:59'} 
ORDER BY MsgSent, tblCAPMessages.Identifier

这是冷融合代码,这是所有遗留代码。我不久前继承了这个系统,但对此却一无所知。我被告知该页面大约一个月前工作,但我没有看到任何证据。

<CFQUERY NAME="GetIncidents" DATASOURCE="#CADS_Datasource#" CachedWithin="#CreateTimeSpan(0,1,0,0)#">
    SELECT  #CADS_Table#.*, tblCADSNotes.Notes  
    FROM    #CADS_Table# LEFT JOIN tblCADSNotes ON #CADS_Table#.Identifier = tblCADSNotes.Identifier
    WHERE   
            #CADS_Table#.MsgSent BETWEEN #Stdate# AND #Enddate# 
            <CFIF IsDefined("attributes.IncidentID")>
                AND #CADS_Table#.IncidentID = #attributes.IncidentID# 
            </CFIF>

            <CFIF IsDefined("attributes.ReportCriteria")>
                <CFLOOP LIST="#attributes.ReportCriteria#" INDEX="criteria">
                    AND #CADS_Table#.#criteria# = '#evaluate( "attributes." & criteria )#'
                </CFLOOP>
            </CFIF>

            <CFIF IsDefined("attributes.Group")>
                    AND #CADS_Table#.DispatchGroup ='#TRIM(attributes.DispatchGroup)#'
            </CFIF>

            <CFIF IsDefined("attributes.ID")>
                    AND #CADS_Table#.Identifier >='DIV#TRIM(attributes.Identifier)#'
            </CFIF>

            <CFIF IsDefined("attributes.Division")>
                AND ( (0=1)
                <CFLOOP LIST="#attributes.Division#" INDEX="criteria">
                    OR (#CADS_Table#.Division = '#criteria#')
                </CFLOOP>
                )
            </CFIF>
    ORDER BY MsgSent, #CADS_Table#.Identifier   
</CFQUERY>


<TABLE Width="100%">
    <TR>
        <TD Align="CENTER">
            <FONT Color="red"><H3>Complete CADS Event Report</H3></FONT>
        </TD>
    </TR>
</TABLE>

    <TABLE Align="Center" Border="1">
    <TR bgcolor="Silver">
        <TH CLASS="ReportHeaderCell">MsgSent</TH>
        <TH CLASS="ReportHeaderCell">Identifier</TH>
        <TH CLASS="ReportHeaderCell">MsgType</TH>
        <TH CLASS="ReportHeaderCell">TenCode</TH>
        <TH CLASS="ReportHeaderCell">Severity</TH>
        <!--- <TH CLASS="ReportHeaderCell">Certainty</TH> --->
        <TH CLASS="ReportHeaderCell">Status</TH>
        <!--- <TH CLASS="ReportHeaderCell">Division</TH> --->
        <TH CLASS="ReportHeaderCell">DispatchGroup</TH>
        <TH CLASS="ReportHeaderCell">DutyPost</TH>
        <TH CLASS="ReportHeaderCell">Change</TH>
        <TH CLASS="ReportHeaderCell">CountyCode</TH>
    </TR>
    <CFIF GetIncidents.RecordCount NEQ 0>
        <CFOUTPUT QUERY="GetIncidents">
            <TR>
                <TD Align="center">#DateFormat(MsgSent,"mm/dd/yyyy")#<BR>#TimeFormat(MsgSent,"h:mmtt")#</TD>
                <TD Align="center"><FONT Color="Blue">#TRIM(Identifier)#</FONT></TD>
                <TD Align="center">
                    <CFIF TRIM(MsgType) EQ "Alert">
                        <FONT Color="Red"><B>#TRIM(MsgType)#</B></FONT>
                    <CFELSEIF TRIM(MsgType) EQ "CANCEL">
                        <FONT Color="Green"><B>#TRIM(MsgType)#</B></FONT>
                    <CFELSE>
                        <B>#TRIM(MsgType)#</B>
                    </CFIF>
                </TD>
                <TD Align="center">#TRIM(TenCode)#</TD>
                <TD Align="center">#TRIM(SeverityType)#</TD>
                <!--- <TD>#TRIM(Certainty)#</TD> --->
                <TD Align="center">
                    <CFIF TRIM(CADStatus) EQ "Waiting">
                        <FONT Color="Red"><B>#TRIM(CADStatus)#</B></FONT>
                    <CFELSEIF TRIM(CADStatus) EQ "Cleared">
                        <FONT Color="Green"><B>#TRIM(CADStatus)#</B></FONT>
                    <CFELSEIF TRIM(CADStatus) EQ "">
                        &nbsp;
                    <CFELSE>
                        <B>#TRIM(CADStatus)#</B>
                    </CFIF>
                </TD>
                <!--- <TD>#TRIM(Division)#</TD> --->
                <TD Align="center">#TRIM(DispatchGroup)#</TD>
                <TD Align="center">
                    <CFIF TRIM(DutyPost) EQ "">
                        &nbsp;
                    <CFELSE>
                        #TRIM(DutyPost)#
                    </CFIF>
                </TD>
                <TD Align="center">
                    <CFIF TRIM(ChangeAudit) EQ "">
                        &nbsp;
                    <CFELSE>
                        #TRIM(ChangeAudit)#
                    </CFIF>
                <TD Align="center">
                    <CFIF TRIM(Jurisdiction) EQ "">
                        &nbsp;
                    <CFELSE>
                        #TRIM(Jurisdiction)#
                    </CFIF>
                </TD>
            </TR>
            <TR>
                <TD ColSPAN="12">
                    <B>HEADLINE:</B> #TRIM(Headline)#<BR>
                    <B>DESCRIPTION:</B> #TRIM(AreaDescription)#<BR>
                    <B>NOTE:</B> #TRIM(Note)#                   
                    <CFIF Notes NEQ "">
                        <CFSET NotesReplaced = Trim(Replace( Notes, "&##39", "","ALL" ))>
                        <CFSET NotesReplaced = Replace( NotesReplaced, """", "","ALL" )>
                        <CFSET NotesReplaced = Replace( NotesReplaced, CrLf, "<BR>","ALL" )>                    
                        <BR>Dispatcher Notes:  #NotesReplaced#
                    </CFIF>
                </TD>
            </TR>
            <TR>
                <TD ColSPAN="12" bgcolor="##0033FF">&nbsp;</TD>
            </TR>
        </CFOUTPUT>
    <CFELSE>
        <TR>
            <TD ColSPAN="12" Align="Center">No CADS messages found!</TD>
        </TR>
    </CFIF> 
</TABLE>

1 个答案:

答案 0 :(得分:0)

事实证明这不是代码或数据库问题。我进入Coldfusion管理员并更改了它设置为512的最大JVM堆大小(MB),加倍,现在一切正常。