Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inconsistent query results 1

Status
Not open for further replies.

ljevans

Technical User
Apr 4, 2001
53
US
I am running a query inside a <cfloop>. The first time I run the code, I get the expected results. The next time I run the code, the query returns a Null value and I get the following error:

Error Diagnostic Information

An error occurred while evaluating the expression:


total_m = #get_months_eng.total_month# * 53.07



Error near line 12, column 8.
--------------------------------------------------------------------------------

Cannot convert to number.

Please, check the ColdFusion manual for the allowed conversions between data types


The error occurred while processing an element with a general identifier of (CFSET), occupying document position (12:2) to (12:55) in the template file C:\InetPub\eac_report\eacgetmanload.cfm.


Date/Time: 04/04/01 07:20:55
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Remote Address: 192.168.77.173
Query String: project_number=8800


This is my code:

Code:
<cfset all_months = 0>
<cfset month_num = 1>

<cfloop index=&quot;loop_count&quot; from=&quot;1&quot; to=&quot;18&quot;>
	<cfquery datasource=&quot;eac_report&quot; name=&quot;get_months_eng&quot;>
		SELECT Sum(month#month_num#) AS total_month
		FROM eac_manload
		WHERE project_number = '#project_number#'
			  and dept IN (50,51,52,55,57,60,61,62,63,64,65,68,69)
	</cfquery>
	
	<cfoutput query=&quot;get_months_eng&quot;>
		#total_month#
	</cfoutput>
	
	<cfset total_m = #get_months_eng.total_month# * 53.07>
	<cfset all_months = #all_months# + #total_m#>
	<cfset month_num = #month_num# + 1>
</cfloop>
Why is this happening? Any help would be appreciated!
 
Have you had any luck contacting your friend with SQL Server experience about my strange problem? We have been having network problems for about a week now and I have had intermittent access to the internet and outside e-mail. Any help that you can send my way will be greatly appreciated!
 
As an FYI:

I exported my data from SQL to Access and created a new datasource. I ran the code using the new datasource and it ran as expected each and every time with consistent correct results. Is safe to say that I have a SQL problem and not a ColdFusion problem?
 
I would think so. I think you either have something corrupt or something going on in Sql server that's altering your results (like a trigger). It could even be the ODBC driver if you're using ODBC. I would have a SQL server admin take a look as I've never hearad of getting different results from the same table like that.

I'll try to get in touch with my friend today. He's difficult to reach so I may not hear from him for a few days but he's an experienced SQL server admin.

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top