Below is a list containing the SQL Server data types, in order of precedence.
Continue readingTag: t-sql
How to Change the Recovery Model of a SQL Server Database using T-SQL
SQL Server has three recovery models; simple, full, and bulk logged. Each database uses one of these settings.
Backup and restore operations occur within the context of the recovery model of the database
You can change the recovery model of a database by using the ALTER DATABASE
statement along with the SET RECOVERY
option.
Fix: “BACKUP LOG cannot be performed because there is no current database backup.” in SQL Server/SQL Edge
If you’re trying to back up the transaction logs in a SQL Server or SQL Edge database, but you get an error that states BACKUP LOG cannot be performed because there is no current database backup, you’ll need to perform at least one full backup of the database before you attempt to back up the transaction logs.
Continue readingHow to Check the Recovery Model of a Database in Azure SQL Edge using T-SQL
In Azure SQL Edge, you can query the sys.databases
catalog view to see the recovery model for each database.
Fix: “The statement BACKUP LOG is not allowed while the recovery model is SIMPLE” in SQL Server (and SQL Edge)
If you get an error that reads The statement BACKUP LOG is not allowed while the recovery model is SIMPLE when trying to back up a database in SQL Server or Azure SQL Edge, it’s because you’re trying to back up the transaction logs on a database that uses the simple recovery model.
To fix this, change the recovery model to either full or bulk logging.
Continue readingAdd a Time Zone Offset to a datetime2 Value in SQL Server (T-SQL)
In SQL Server, the TODATETIMEOFFSET()
function was specifically designed to return a datetimeoffset value from a datetime2 value.
Given the fact that the datetime2 data type doesn’t actually support time zone offsets, and datetimeoffset must contain the offset, the TODATETIMEOFFSET()
function allows you to specify a time zone offset to use.
This article provides some examples to demonstrate.
Continue readingGet the Number of Failed Login Attempts for a Login due to a Wrong Password in SQL Server (T-SQL)
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.
Continue readingHow to Back Up an Azure SQL Edge Database to Local Disk using T-SQL
Microsoft Azure SQL Edge’s backup capabilities are similar to those in SQL Server on Linux, and SQL Server running in containers.
Azure SQL Edge supports T-SQL, and so you can back up your SQL Edge databases by running a T-SQL statement.
In this article, I back up a SQL Edge database to the local disk in my Docker container.
Continue readingHow to Backup the Transaction Logs in Azure SQL Edge (T-SQL)
By default, databases created in Azure SQL Edge use the simple recovery model. This means that you can’t perform log backups on these databases.
Fortunately, you can change a database’s recovery model to full recovery mode, which will enable you to back up the logs.
Continue readingHow to Change the Recovery Model of a Database in Azure SQL Edge using T-SQL
By default, databases created with Azure SQL Edge use the simple recovery model. This means that you can’t perform log backups on these databases.
If you need to perform log backups on a database created with SQL Edge, you’ll need to change the recovery model of the database to either full or bulk logged.
This can be done with T-SQL with the ALTER DATABASE
statement.