Hi David
Thanks for the help so far. I have no problem with the SQL part - I can use cast to remove the date component.
SELECT [ActivityID]
,[Session]
,[StartTime]
,CAST(StartTime as time)[Time]
,[Duration]
FROM [Merlin].[dbo].[Activity]
But having read the DbFunctionCall examples the syntax has me confused. I can't why I need the second DbFunctionCall ?
// create a filter which filters on month equals 3
IPredicate monthFilter = new EntityField("OrderMonth", new DbFunctionCall("CAST({0} AS bigint)", new object[] { new DbFunctionCall("MONTH", new object[] { OrderFields.OrderDate }) })) == 3;
I would have thought something like this would work for a range check where DBTime >= STARTTIME <= DBTime+Duration
EntityField time = new EntityField("ActivityTime", new DbFunctionCall("CAST({0} AS time)",new object[] {ActivityFields.StartTime}));
filter.AddWithAnd( new PredicateExpression(time >= StartTime));
filter.AddWithAnd(new PredicateExpression(time < StartTime.Value.AddMinutes(Duration)));
Or I am making a meal of this?
Mark