Reading Time: 2 minutesSometimes, you want to execute certain SQL code only if you know that a specific column exists within a table. There is an extremely simple way to check if a column exists within a table in SQL Server: Use the COL_LENGTH system function! The syntax of the COL_LENGTH system function Continue Reading
Don’t make this mistake when calling your SQL Stored Procedures!
Reading Time: 3 minutesStored Procedures are complicated beasts in Microsoft SQL Server. There are many quirks you should be aware of when creating and calling them. In this very brief tutorial, we’ll talk about one of those wacky rules. Take a look at the following Customers and ContactInfo tables: We have a stored Continue Reading
SQL Server IS NULL: Why can’t I just use “= NULL”?
Reading Time: 4 minutesThe IS NULL predicate is a very useful thing to know when it comes to querying data and working with columns containing NULL. In this very brief tutorial, we’ll talk about why you need to use IS NULL instead of something like “= NULL” when checking if a value contains Continue Reading
SQL IF EXISTS Decision Structure: Explained with Examples
Reading Time: 6 minutesThe SQL IF EXISTS tool is great to know for managing the flow of control of your SQL code. In this very brief tutorial, we’ll discuss everything you need to know about the IF EXISTS decision structure in SQL Server. We’ll discuss these topics: What is the SQL IF EXISTS Continue Reading
CROSS JOIN in SQL Server: Explained for Beginners
Reading Time: 4 minutesKnowing how JOIN operations work in SQL Server is extremely important. I would say most of the queries you will ever right in your career as a database professional will involve some kind of JOIN operation. The INNER and LEFT JOINS are the most common, but it’s also important to Continue Reading
How to get the data type of a return value in SQL Server
Reading Time: 3 minutesSometimes when writing T-SQL code (or code in any other language), it can be useful to know the data type of a value returned from an object. I was working on a tutorial recently where I wanted to show you the data type that was returned by an operation, but Continue Reading
How to create a table variable in SQL Server
Reading Time: 4 minutesIn this very brief tutorial, we’ll discuss how you can create a table variable in Microsoft SQL Server. Knowing how to create a SQL Server table variable can be very useful when querying data in a database. It is very simple, and there are only a few rules you need Continue Reading
SQL Server GO: Explained with Examples
Reading Time: 6 minutesThe SQL Server GO keyword is extremely common when querying and developing SQL Server databases. It is important that you understand how it works if you regularly create objects (such as tables, stored procedures, views, etc.) in a SQL Server database. In this very brief tutorial, we will discuss everything Continue Reading