How to Insert Values into an IDENTITY Column in SQL Server

If you’ve ever tried to insert values into an identity column in SQL Server, you might’ve seen an error like this:

Cannot insert explicit value for identity column in table ‘Artists’ when IDENTITY_INSERT is set to OFF.

This is normal. An identity column is there for a reason. It automatically populates the column with an incrementing value for each row that’s inserted. Therefore there’s no need for you to insert a value into that column.

However, sometimes you do need to insert a value into an identity column. For example, you could be populating the database with data that needs to retain its own identity values. If this is the case, you’ll need to override the IDENTITY property. Here’s how.

Continue reading

T-SQL vs SQL

Here’s a quick overview of the difference between SQL and T-SQL (Transact-SQL). Not so much the differences as such, but more an explanation of T-SQL and where it sits in relation to SQL.

If you’ve done any database development or administration, you’re probably familiar with SQL. SQL, which stands for Structured Query Language, is a standard query language for working with databases. Most of the major relational database management systems such as MySQL, Oracle, SQL Server, PostgreSQL, etc support SQL in one way or another.

However, while the SQL standard provides clear specifications, it also allows for database vendors to add their own extensions. This allows vendors to provide extra features and functionality for their customers that might not be offered by their competitors.

This is where T-SQL comes in.

Continue reading

How to Restore a SQL Server Database on a Mac using SQL Operations Studio

UPDATE: SQL Operations Studio (SQLOPS) has since been renamed to Azure Data Studio. The steps in this article remain the same though. In any case, I’ve also rewritten these steps (and included the equivalent screenshots) specifically for Azure Data Studio . See How to Restore a SQL Server Database on a Mac using Azure Data Studio.

Restoring a database is a piece of cake with SQL Operations Studio. It’s a similar process to doing it with SQL Server Management Studio.  Simply click Restore and follow the prompts.

This restore process allows you to navigate through the computer’s file system to locate the .bak file. This .bak file contains a backup of the database you want to restore. So when SQL Server restores the database, it’s using the .bak file to do so.

However, if you’re running your SQL Server instance inside a Docker container (which of course, you would be if you’re running SQL Server on Mac or Linux), there’s something you need to be aware of if your backup file is located outside the Docker container.

Continue reading

Create a SQL Server Database with SQLOPS

UPDATE: SQL Operations Studio (SQLOPS) has since been renamed to Azure Data Studio. The steps in this article remain the same though. In any case, I’ve also rewritten these steps (and included the equivalent screenshots) specifically for Azure Data Studio . See Create a SQL Server Database with Azure Data Studio.

Here, I explain how to use SQL Operations Studio (SQLOPS) to create a database in SQL Server.

In my case, I’m running SQL Server on a Mac (via a Docker container), but these instructions are generic and should work exactly the same way on Linux and Windows.

This tutorial assumes you already have SQLOPS installed on your machine, and you’ve connected to your SQL Server instance. If you don’t have SQLOPS installed on your machine, here are instructions for installing it on a Mac and connecting to SQL Server via Docker.  The SQLOPS installation is pretty straightforward (you install it just like any other software), so if you’re on Linux or Windows, you shouldn’t have any issues.

Continue reading

How to Install SQLOPS on a Mac

UPDATE: SQL Operations Studio (SQLOPS) has since been renamed to Azure Data Studio. The steps in this article remain the same though. In any case, I’ve also rewritten these steps (and included the equivalent screenshots) specifically for Azure Data Studio . See How to Install Azure Data Studio on a Mac.

SQL Operations Studio (also abbreviated to SQLOPS) is a free tool that you can use to manage SQL Server. It uses a graphical user interface (GUI) that helps you view the various databases and objects within a SQL Server instance. It can run on Windows, macOS, and Linux, and it’s also designed to be used with Azure SQL Database, and Azure SQL Data Warehouse.

Here I explain how to install SQLOPS onto a Mac, then how to use it to connect to SQL Server.

Continue reading

How to Install SQL Server on a Mac

Here I’ll show you how to get SQL Server up and running on your Mac in less than half an hour. And the best part is, you’ll have SQL Server running locally without needing any virtualization software.

Prior to SQL Server 2017, if you wanted to run SQL Server on your Mac, you first had to create a virtual machine (using VirtualBox, Parallels Desktop, VMware Fusion, or Bootcamp), then install Windows onto that VM, then finally SQL Server. This is still a valid option depending on your requirements (here’s how to install SQL Server on a Mac with VirtualBox if you’d like to try that method).

Starting with SQL Server 2017, you can now install SQL Server directly on to a Linux machine. And because macOS is Unix based (and Linux is Unix based), you can run SQL Server for Linux on your Mac. The way to do this is to run SQL Server on Docker.

So let’s go ahead and install Docker. Then we’ll download and install SQL Server.

But first… if you’re using a Mac with the M1 chip, see How to Install SQL Server on an M1 Mac (ARM64).

Continue reading

Is it Pronounced “S-Q-L” or “Sequel”?

Ever since its early days, there’s confusion over how to pronounce SQL. If you’ve ever worked in a large team of SQL developers, you might’ve heard some developers pronouncing it as “S-Q-L” or “ess-que-ell” [ ˈɛs kjuː ˈɛl ] and others using “sequel” [ ˈsiːkwəl ].

And the confusion extends itself to commercial and open source products too. Any mispronunciation will extend itself to products such as SQL Server and MySQL, not to mention product tools and features such as MySQL Workbench, mysqladmin, mysqldump, and Access’s SQL view, to name a few.

Continue reading

A Technical Comparison: Microsoft Access 2016 vs SQL Server 2016

Microsoft Access and SQL Server are two relational database management systems from Microsoft. Each has its own strengths and weaknesses. There are many cases where Access is the ideal tool for the job. There are other times where a more sophisticated solution like SQL Server is more appropriate.

When trying to decide which one to use, a side-by-side comparison of the technical specifications of each system can help greatly. Below is a side-by-side comparison of some of the technical limitations of each system.

Continue reading