Reading Time: 3 minutesForeign key constraints are an excellent way to preserve the referential integrity of the data in your database. If you’re new to SQL Server and don’t fully understand what a foreign key is or how they work, make sure you check out the full beginner-friendly tutorial first to learn everything Continue Reading
SQL Questions
How to find a string within a string in SQL Server: Explained with Examples
Reading Time: 5 minutesThe task of finding a character string within a larger character string in a SQL Server database is very easy. SQL Server has many built-in system functions that can be used for character string manipulation, one of which is the CHARINDEX function. We use the CHARINDEX system function to locate Continue Reading
How to drop a column in SQL Server: Explained with Examples
Reading Time: 4 minutesKnowing how to make modifications to the definition of a table is very important when it comes to developing Microsoft SQL Server databases. The task of deleting a column is very straightforward. In this very brief tutorial, we’ll discuss how to drop a column from a Microsoft SQL Server table. Continue Reading
How to Find Text in a SQL Server Stored Procedure: Just run this one query!
Reading Time: 4 minutesThere might be times when you simply need to search through the objects in a SQL Server database for a specific word or text. It would be a very tedious task to open each stored procedure, function, View, etc. and look through each to see if it references the text Continue Reading
What does “SET NOCOUNT ON” do in SQL Server? Explained!
Reading Time: 5 minutesMaybe you’ve been working with SQL Server for a while and have seen “SET NOCOUNT ON” here and there, but you aren’t really sure what it does. It’s usually seen within stored procedures, but it can be used anywhere. In this very brief tutorial, we’ll discuss what the SET NOCOUNT Continue Reading
How to find foreign key references in SQL Server: Just run this one query!
Reading Time: 4 minutesSQL Server foreign key constraints are one of the most useful tools available to us for maintaining the integrity of our data. If you want to find all the foreign key references in your database, there is a very simple query you can run. Just query the sys.foreign_keys and sys.foreign_key_columns Continue Reading
How to find a SQL Server column name: Run this one simple query!
Reading Time: 3 minutesIf you have a particularly large database, finding a specific column might be a bit of a challenge. Maybe you don’t recall exactly what the column name is, and you’re not sure what table it belongs to. Luckily, Microsoft SQL Server has some build in system tables that can help Continue Reading
How to reseed an IDENTITY value in SQL Server: A guide for beginners
Reading Time: 5 minutesThe IDENTITY property is one of the most useful tools available to us in Microsoft SQL Server. We basically use it to automatically populate an integer column with a new value on inserts. It’s a great way to let SQL Server manage the integer values placed in a column so Continue Reading
SQL Server Implicit Transaction Mode: Proceed with Caution!
Reading Time: 4 minutesImplicit transactions are a strange thing in SQL Server. It’s very important to understand how transactions work in Microsoft SQL Server and to understand the different tools available to us when writing transactions. One such tool is the “IMPLICIT_TRANSACTIONS” mode. But beware. Enabling this feature can have unforeseen consequences! In Continue Reading
How To Get a Running Total of Your SQL Data: Explained for Beginners
Reading Time: 5 minutesIn this very brief tutorial, we’ll discuss how to gather a very particular kind of SQL data: A running total. The best way I found to gather a running total (sometimes called a rolling total) of SQL data is to… Use the SUM() aggregate window function There might be other Continue Reading