All Questions
13
questions
3
votes
1
answer
1k
views
Daily SQL job to delete records older than 24 hours
Below is a delete job to delete 1M+ records daily and takes 13 hours to complete and sometimes more than that. I need to optimize this.
The table tblcalldatastore is being inserted 24*7 through a ...
1
vote
1
answer
1k
views
Determining daylight-saving time in Central European Time
(We are on SQL Server 2008).
The following constellation:
Our applications passes date&time around (in the most horrible way possible).
We want to simplify this. Instead of a culture-specific ...
4
votes
1
answer
99
views
Get local datetime from UTC time
One of the app is inserting date in UTC format (column CreateDate). When reporting from this table, I used a difference in hours between the inbuilt ...
8
votes
2
answers
208
views
Execute every Monday that is not the Monday following last Saturday in month
I think the following is good but wondering if it can be simplified or improved.
My condition for code execution is the following:
It is a Monday
AND
It is not the Monday following the last Saturday ...
4
votes
1
answer
48
views
Selecting time metadata off a calendar table
I have a report on SSRS (that's SQL Server Reporting Services) that I need to be able to parameterize so that it can run for..
Yesterday (scheduled every morning)
The week that just elapsed (...
4
votes
1
answer
71
views
Returning two dates based on input
I created a function that will return 2 dates that depend on an input parameter.
When the parameter is:
1 - return start date of current week and end date of current week
2 - return start date of ...
6
votes
1
answer
662
views
Working Days DateDiff function
I have a calendar table with a record for every date I need to care about (i.e. 365 records per year), with various meta-information about each date, including the weekday, the fiscal calendar week, ...
1
vote
1
answer
71
views
Get Next and Previous "Load Day"
I keep looking at this trying to figure if there's a better way. All three functions work, but I wanted to get some insights and ideas from others.
IsLoadDay ...
3
votes
3
answers
137
views
Cluster date time values
I came up with this TSQL for SQL Server 2008:
...
6
votes
2
answers
221
views
Calculating a time in a time zone from multiple dates in SQL
I'm trying to calculate what time a certain time in a time zone is today, so I can schedule something to happen at that time in that time zone.
I've got a table with what I have termed the Nominal ...
7
votes
1
answer
1k
views
Count and group rows for six months prior
I've written the following query for SQL server:
...
3
votes
2
answers
231
views
Computing the week for a certain date
I have the following SQL query that computes for every date the week it falls in (a week begins on Sunday and ends on Saturday):
...
5
votes
2
answers
3k
views
Selecting the number of working days minus weekend days and UK bank holidays
I am fairly new to coding TSQL script and am looking for some second view on my script.
The goal here is to to pull in some data and amongst that data to show a field with a counting the number of ...