Articles

SQLServerCentral Article

Standards Are a Good Thing

This week we have another article from Andy that discusses some changes he made at work in conjunction with clustering all his database servers. Not a how-to, just comments about what was changed and why. Worth reading just for the reminder about the potential gotcha that @@ServerName can represent.

You rated this post out of 5. Change rating

2003-04-09

6,161 reads

Technical Article

Free Webcast Today: SQL Server Security Best Practices

Join SQLServerCentral.com co-founder Brian Knight for this free webcast on SQL Server security best practices. In this session on Technet, we will look at how to protect your system from internal and external security factors. We will look at the types of permissions in your database objects, implementing column and row-level security, and protecting yourself from SQL Injection attacks. We'll also cover best practices for basic and advanced protection for your SQL Server system.

2003-04-02

1,994 reads

SQLServerCentral Article

Cluster That Index!

Quite a while back Andy wrote an article about why not using primary keys and clustered indexes was a worst practice. Chris weighs in this week with a great article that gives some more in depth info on clustered indexes and why he thinks they should be used on every table.

4.8 (10)

You rated this post out of 5. Change rating

2003-03-30

18,732 reads

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

Find rows with very close time stamps

By daytonbrown2

Given the following table and query, this will return any records(based on message_id) that...

How to merge two tables with unlike fields

By landonh

How to merge two tables with unlike fields. I have two table with one...

Visual Studio 22 / SSIS Project / (Project) Connection problem

By WilburSmith

Hello, First of all, I find it odd/annoying that I can't exclude a Project...

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