Tag

#SQL

15 blogs

  1. T-TSQL - Create 4 week Moving Total

    This article will offer you a way to calculate a 4 week moving total in SQL using SQL Server. There are more ways to Rome but this is a way you can use to calculate it using a date dimension.

    SQL Server, Power BI7 Dec 2015 · 7.4k reads
    7.4k
  2. Calculate time in hours and minutes between two dates

    Sounds easy right? I want to calculate the difference in hours and minutes between two dates. A good readable notition for my report. I want a format like this: 00:36:53 OR 02:13:45 This can easy be ...

    SQL Server1 comment9 Oct 2013 · 6.3k reads
    6.3k
  3. After update trigger

    Sometimes it is useful to keep track of a modification date or modification user in a field, especially in a master data environment. You can use a trigger on a table for this. It must work both ...

    SQL Server27 Mar 2013 · 4.2k reads
    4.2k
  4. Calculate the nearest working day

    Last week I had a nice challenge. In the KPI table I use for certain reports, only the normal working days are calculated, Monday to Friday. Public holidays are in there too. The ...

    SQL Server1 comment6 Nov 2012 · 4.7k reads
    4.7k
  5. Dutch public holidays in SQL Server

    Sadly there is no standard function in SQL Server to check whether a date is a public holiday. To find out, it helps to use a date dimension as explained here ...

    SQL Server29 Aug 2012 · 6.8k reads
    6.8k
  6. Centralizing KPIs in your data warehouse

    You build brilliant reports with the best figures, revenue, productivity and KPIs. Over time more and more reports appear within the organization. Until someone suddenly notices that the ...

    SQL Server3 comments24 May 2012 · 5.7k reads
    5.7k
  7. Calculating running totals

    A lot has been written about it on the internet already, but I thought it was worth posting an article about calculating running totals in Microsoft SQL Server 2005 / 2008. There are ...

    SQL Server24 May 2011 · 5.3k reads
    5.3k
  8. Script all databases and objects

    Following an earlier article about scripting your database objects, I made a stored procedure that scripts all databases for you automatically and writes the script to a ...

    SQL Server3 Mar 2010 · 3.9k reads
    3.9k
  9. How do I make a date dimension?

    Date dimensions are very useful. With a date dimension / date table you can look up for any date which week it falls in, which year, which month, whether it is a public holiday ...

    SQL Server9 comments24 Feb 2009 · 12.4k reads
    12.4k
  10. Date calculations

    In SQL Server 2005 you can do date calculations in several ways. SQL Server 2005 has several functions you can use when you work with dates. This article describes a number of ...

    SQL Server2 comments5 Dec 2008 · 20.3k reads
    20.3k
  11. Finding duplicate rows

    Every row in a table is identified by a primary key. Now and then the key occurs twice in your system. That should not happen. With this simple query you can ...

    SQL Server2 Dec 2008 · 9.5k reads
    9.5k
  12. Query Active Directory

    It can be useful to include data from your Active Directory (AD) in your data warehouse. In my case it was useful because the customer wanted to see whether a user who had left the company still ...

    Data Warehousing17 Nov 2008 · 8.4k reads
    8.4k
  13. Recursive Query with CTE I

    I recently ran into a problem that I found interesting enough to put on my blog. It covers a common situation where you use a dataset several times, also called a ...

    SQL Server7 Nov 2008 · 4.7k reads
    4.7k
  14. Convert a date to an integer

    In data warehouse land we use integers as primary keys for the date in our date dimension. So we store the date "2008-12-01 00:00:00.000" as "20081201". This lets you ...

    SQL Server26 Feb 2008 · 7.4k reads
    7.4k
  15. The 3 best ways - Find a column in a SQL database

    You want to find a column in one of the tables in your SQL Server database. Your database has a few hundred tables. Expanding all the tables to look for the column can be a time-consuming job ...

    SQL Server23 Jan 2008 · 18.6k reads
    18.6k
(15 rows affected)sqlblog.nl