In SQL Server, you can use the LOGINPROPERTY() to return information about login policy settings.
This includes being able to return data for bad password attempts, as well as the time of the last failed login attempt due to a bad password.
In SQL Server, you can use the LOGINPROPERTY() to return information about login policy settings.
This includes being able to return data for bad password attempts, as well as the time of the last failed login attempt due to a bad password.
Most of the major RDBMSs have functions that enable us to extract the day, month, and year from datetime values.
Some RDBMSs provide multiple ways to do this, and others are more limited. Below are examples of extracting the day, month, and year from date values in some of the most popular RDBMSs.
SQL Server provides us with a quick and easy way to format numbers with commas inserted at the relevant place. For example, 1234.56 can become 1,234.56. Or it can become 1.234,56, if that’s the locale that you’re using.
Update January 2026: When I wrote this article in 2021, the full SQL Server image couldn’t be installed on Apple Silicon machines (the M1 Macs). We had to install SQL Edge instead, which is why I wrote this article. Fortunately, things have progressed since then, and we can now install the full SQL Server image on Apple Silicon machines (including M1, M2, M3, M4).
Therefore, I recommend you read How to Install SQL Server on a Mac in 2026 instead of this article. It’s a very similar process to the one outlined in this article, but it actually installs SQL Server instead of SQL Edge (which has since been retired).
In SQL Server, you can use the ALTER LOGIN statement to change the default language for a specific login.
Doing this will ensure that whenever that login connects to SQL Server, all date/time formats and system messages are presented in the correct format and language.
You can use the SUSER_ID() function to return the login identification number of the current user.
You can also use it to return the login ID of another user.
This is similar to returning the current login name, except here we’re returning the ID instead.
Occasionally you might find yourself in the situation where you need to get the name of the current workstation that’s connected to SQL Server.
For example, maybe you have a stored procedure that inserts data, and you want to record the name of the workstation that inserted the data.
In such cases, you can use the HOST_NAME() function.
This is not to be confused with getting the server name.
You can use the SWITCHOFFSET() function in SQL Server to change the time zone offset on a datetimeoffset value.
The function accepts two arguments; a datetimeoffset(n) value (or an expression that can be resolved to a datetimeoffset(n) value), and the new time zone.