Skip to content
Advertisement

Tag: tsql

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

How to delete all duplicate records from SQL Table?

Hello I have table name FriendsData that contains duplicate records as shown below I want to remove duplicate combinations rows using MS SQL? Remove latest duplicate records from MS SQL FriendsData table. here I attached image which highlights duplicate column combinations. How I can removed all duplicate combinations from SQL table? Answer Try this See here Or here is more

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