Here are a couple of T-SQL methods you can use to return the server name in SQL Server.
Ian
Return the Current Login Name in SQL Server (T-SQL)
You can use the SUSER_NAME() function to see the login name that you’re currently using to access SQL Server.
This function returns returns the login identification name of the user. It also allows you to get the login name of any other user, based on their login identification number.
Change the Language for the Current Session in SQL Server
You may know that when you connect to SQL Server, the language for that session is usually determined by your login. When a login is created, it is assigned a default language.
The session language determines the datetime formats and system messages.
While you can certainly change the default language for a login, you can also override the default language within a session if you need to. You can toggle back and forth between languages if required. Or you could even open two separate connections and apply a different language to each of them.
This article explains how to change the language within a session.
Change the Date Format For the Current Session in SQL Server
Whenever you connect to SQL Server, a bunch of default settings are applied to your session. These include the language and the date format settings.
The date format is normally determined by your default language. For example, if your default language is us_english, then the default date format will probably be mdy, and the first day of the week will be day 7 (Sunday).
If you change your language, you the date format will implicitly be updated accordingly.
However, you still have the option of changing the date format without changing the language. To do this, you can use SET DATEFORMAT.
Convert a Date to Another Time Zone in SQL Server
The AT TIME ZONE clause was introduced in SQL Server 2016 to convert a date into a datetimeoffset value in a target time zone.
This function is similar to some other T-SQL functions, such as SWITCHOFFSET() and TODATETIMEOFFSET(), however, the AT TIME ZONE clause allows/(requires) you to specify the time zone offset by name, instead of an actual offset value.
This article explores how AT TIME ZONE works, and explains its benefits when compared to the other functions mentioned.
Get a List of Supported Time Zones in SQL Server (T-SQL)
SQL Server provides the sys.time_zone_info server-wide configuration view to return a list of supported time zones.
You can retrieve these with a simple SELECT statement.
Get the Current Time Zone of the Server in SQL Server (T-SQL)
Microsoft introduced the CURRENT_TIMEZONE() function in SQL Server 2019 for returning the time zone of the server.
More specifically, this function “returns the name of the time zone observed by a server or an instance”.
4 Ways to Update a Document in MongoDB
MongoDB provides various ways to update a document. The method you use will depend on exactly how you want to perform the update.
This article presents 4 ways to update a document in MongoDB.
MongoDB $push vs $addToSet: What’s the Difference?
How to Delete a SQL Server Agent Job in Azure Data Studio
If you’ve installed the SQL Server Agent extension in Azure Data Studio, you will be able to see a list of SQL Server Agent jobs, as well as create, edit, view history, etc.
But you may be wondering how to delete a job.
If so, read on.