Articles

External Article

When an update doesn’t update

Tell me if you’ve heard this one before: I changed data from my application, but when I checked the database, I couldn’t see the change! I’ve seen this. Loads. It can be quite perplexing for folks because they expect to see an error message if the insert, update, or delete failed.

2023-12-15

SQLServerCentral Article

SQL Window Functions Series: LAG() and LEAD()

Dive deep into the powerful SQL window functions, LAG() and LEAD(). Explore their intricacies, discover real-world examples, and avoid common pitfalls.

5 (3)

You rated this post out of 5. Change rating

2023-12-11

6,105 reads

External Article

What is subsetting, what are the advantages, and how does it make test data management easier?

As data grows and databases become larger and more complicated, data
subsetting provides a method of working with a smaller, lighter copy of a
database to make development and testing faster and easier.

In this article, James Hemson poses the questions; what exactly is data subsetting, how and why are developers using it – or not using it, and
what’s prompting conversations about it?

2023-12-11

Blogs

Free webinar – Tackling the Gaps and Islands Problem with T-SQL Window Functions

By

I’m hosting a free webinar at MSSQLTips.com at the 19th of December 2024, 6PM...

Counting Groups with Window Functions: #SQLNewBlogger

By

I looked at row_number() in a previous post. Now I want to build on...

Read the latest Blogs

Forums

How to determine if a DB is currently being used

By dax.latchford

Hi - I'm looking for advice regarding the best & quickest way to establish...

Data cleansing/conversion tool HPE

By juliava

Hello.   I am looking for a tool Data cleansing/conversion, was recommended HPE any...

System views in a contained availability group

By mark4data

I have a query that runs in a job to check on orphaned users....

Visit the forum

Question of the Day

The LAGging NULL

I have this data in a SQL Server 2022 table:

player         yearid team HR
Alex Rodriguez 2012   NYY  18
Alex Rodriguez 2013   NYY  7
Alex Rodriguez 2014   NYY  NULL
Alex Rodriguez 2015   NYY  12
Alex Rodriguez 2016   NYY  9
If I run this code, what are the results returned in the hrgrowth column?
SELECT
  player
, yearid
, hr
, hr - LAG (hr, 1, 0) IGNORE NULLS OVER (ORDER BY yearid) AS hrgrowth
FROM dbo.playerstats;

See possible answers