JSON_QUERY() vs JSON_VALUE() in SQL Server: What’s the Difference?

Two of the many T-SQL functions available in SQL Server are JSON_QUERY() and JSON_VALUE(). These functions can be used to extract data from JSON documents.

Their general syntax is similar, and at first glance, you might think they do exactly the same thing, but they don’t. There’s definitely a place for both functions when working with JSON and SQL Server.

This article looks at the difference between JSON_QUERY() and JSON_VALUE().

Continue reading

@@DATEFIRST – Get the First Day of the Week in SQL Server

In SQL Server, the first day of the week is determined by the current language settings. You can also override that with the SET DATEFIRST statement, which allows you to explicitly set the first day of the week.

In either case, you can use the @@DATEFIRST function to find out what settings your session is using for the first day of the week. This article demonstrates how.

Continue reading

SET DATEFIRST – Set the First Day of the Week in SQL Server

In SQL Server, you can use SET DATEFIRST to set the first day of the week.

The first day of the week can be different, depending on the language being used. For example the default for us_English is 7 (Sunday), whereas the default for Deutsch (German) is 1 (Monday).

This article demonstrates how to change the first day of the week without changing the language.

Continue reading