In SQL Server, you can use the MONTH()
function to convert a month name to its corresponding number.
Tag: how to
Insert Characters into the Middle of a String in SQL Server (T-SQL)
SQL Server provides the STUFF()
function that enables you to insert a string inside another string.
The function also allows you to specify the number of characters (if any) to delete from the original string in order to fit the new string.
Continue reading3 Ways to Extract the Year from a Date in SQL Server (T-SQL)
There are several ways to return the year from a date in SQL Server. Here are three (or is it four?).
Continue reading8 Ways to Add Seconds to a Datetime Value in MariaDB
If you need to add one or more seconds to a datetime value in MariaDB, here are 8 options to consider.
Continue reading3 Ways to Get the Month Name from a Date in MariaDB
Here are three ways to return the month name from a date in MariaDB.
Continue readingSubtract a Month from a Date in MariaDB
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a month (or many months) from a given date.
Here’s an example of subtracting a month from a date in MariaDB.
Continue reading2 Ways to Get the Default Language of a Login in SQL Server (T-SQL)
There are (at least) a couple of ways you can use T-SQL to return the default language of a specified login in SQL Server.
In particular, you can use the following methods:
- Query the
LOGINPROPERTY()
function. - Query the
sys.server_principals
system catalog view in themaster
database.
Examples of these are below.
Continue readingRename a User Defined Data Type in SQL Server (T-SQL)
In SQL Server, you can use the sp_rename
stored procedure to rename a user created object in the current database, including a user-defined data type.
6 Ways to Add a Month to a Date in MariaDB
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a month (or many months) from a given date.
Here are 6 ways to add a month to a date in MariaDB.
Bonus update: I’ve now added a 7th way to add a month to a date at the end of this article. So I guess it’s now 7 ways to add a month to a date in MariaDB 🙂
Continue readingHow to do an UPDATE Pass-Through Query in SQL Server
In SQL Server, the OPENQUERY
rowset function enables you to execute a pass-through query on a linked server.
OPENQUERY
is commonly referenced in the FROM
clause of a query as if it were a table, but it can also be referenced as the target table of an INSERT
, UPDATE
, or DELETE
statement.
This article presents an example of using OPENQUERY
to do an UPDATE
pass-through query.