Skip to content
Advertisement

Tag: sql-server-2008

Numbers of weekdays in a date range in TSQL

This is harder than it looks. I need a function that calculates the numbers of a given weekday in a date range. I don’t want any loops or recursive SQL. There are millions of examples doing just that. I need a fast function for calculation. Input of the function will be weekday, fromdata, todate Expected result: Answer @Mikael Eriksson has

Simple DateTime sql query

How do I query DateTime database field within a certain range? I am using SQL SERVER 2005 Error code below Note that I need to get rows within a certain time range. Example, 10 mins time range. Currently SQL return with Incorrect syntax near ’12’.” Answer You missed single quote sign: Also, it is recommended to use ISO8601 format YYYY-MM-DDThh:mm:ss.nnn[

Advertisement