How do I SET DATEFIRST 1 with PetaPoco in a Query or manage pooled connections -
i have query groups results week. in order ensure consistent week start trying add first line peta poco db.query(sql) method.
set datefirst 1 select count(logdate) value, dateadd(week, datediff(week,0, logdate),0) [date] ... etc ...
without set datefirst 1
petapoco generates like...
exec sp_executesql n' select count(logdate) value, dateadd(week, datediff(week,0, logdate),0) [date] ... etc ...
with set datefirst 1
petapoco generates like...
exec sp_executesql n'select [datapoint].[date], [datapoint].[value] [datapoint] set datefirst 1 select count(logdate) value, dateadd(week, datediff(week,0, logdate),0) [date] ... etc ...
how around generating incorrect sql? docs looks can use db.execute("set datefirst 1");
long executes on same connection, since connections managed me, need ensure it's same connection query?
put semicolon first char tell petapoco execute query is
db.execute(";set datefirst 1 ....
Comments
Post a Comment