LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.worksheet.functions,microsoft.public.excel
Who be dat?
 
Posts: n/a
Default Error message "formula is too long"

Thanks Duke!! Excellent suggestion. I'll give it a shot.

Chris Smith
"Duke Carey" wrote in message
...
Chris -

Your life would be greatly simplified if you made your query a Stored
Procedure, along the lines of what's shown below, and you could execute it
by
simply using

exec QueryForChris A7

If you are using ADO, "exec QueryForChris" is your command text, A7 is the
value for the parameter, and you need to set the command type to
"adCmdStoredProc"

==================================================
CREATE PROCEDURE QueryForChris
@CurrentTime smalldatetime

AS
DECLARE @startdate datetime
DECLARE @enddate datetime

SET @StartDate = DateAdd(hh, -2, @currenttime)

SET @EndDate = @currenttime

SELECT Top 1 DateTime, Convert(decimal(38,3), Value)

FROM AnalogHistory

WHERE TagName in ('hucTurbidity_001.PV')

AND wwRetrievalMode = 'Cyclic'

AND value IS NOT NULL

AND wwVersion = 'Latest'

AND wwResolution = 1000

AND DateTime @StartDate

AND DateTime <= @EndDate

AND DateTime in

(SELECT Datetime

FROM AnalogHistory

WHERE TagName in ('hucFilterHours_001.PV')

AND value 0.0

AND wwResolution = 1000

AND wwRetrievalMode = 'Cyclic'

AND wwVersion = 'Latest'

AND DateTime @StartDate

AND DateTime <= @EndDate)

ORDER BY Value DESC

GO





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overcoming "Formula too long" top.jimmy Excel Worksheet Functions 2 February 20th 06 06:10 PM
"formula for tracking days off " mcwsrexcel Excel Worksheet Functions 1 February 17th 06 03:06 AM
"string too long" error message dick Excel Discussion (Misc queries) 0 January 4th 06 11:02 AM


All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"