How to Combine Two Columns in SQL

How to Combine Two Columns in SQL

In this article, I am going to walk you through exactly how to combine two (or more) columns in SQL. I will cover the modern functions, the legacy operators, and the dreaded “NULL trap” that ruins so many reports. How to Combine Two Columns in SQL Why Is Combining Columns So Complicated? Before we look … Read more

SQL Query to Get Column Names from Table in SQL Server

SQL Query to Get Column Names from Table in SQL Server

In this article, I am going to walk you through exactly how to write a SQL query to get column names from a table in SQL Server. I will cover the standard ANSI methods, the SQL Server-specific system views, and the quick shortcuts I use daily. SQL Query to Get Column Names from Table in … Read more

SQL Server Copy Table To Another Table

SQL Server Copy Table To Another Table

In this article, I am going to walk you through the exact methods I use to copy tables in SQL Server, from the quick-and-dirty one-liners to the robust enterprise-grade scripts. SQL Server Copy Table To Another Table Method 1: The “Select Into” When I need to make a quick backup of a table before running … Read more

Alter table add column at specific position in SQL Server

Alter table add column at specific position in SQL Server

In this article, I am going to walk you through exactly how to alter a table to add a column at a specific position in SQL Server, why this happens, how to achieve your goal using the tools available, and the architectural implications of forcing specific column positions in a relational database. Alter table add … Read more

User Defined Table Type in SQL Server

User Defined Table Type in SQL Server

UDTTs are one of the most underutilized yet powerful features in the T-SQL. They allow you to pass entire tables of data into stored procedures and functions as a single parameter. In this comprehensive guide, I will take you through the architecture, benefits, and best practices of User Defined Table Types. We will move beyond … Read more

SQL Server Create Table With Identity Column

SQL Server Create Table With Identity Column

In this guide, I am going to walk you through everything you need to know to create a table with an identity column in SQL Server. I will share the syntax and the best practices I use today to ensure data integrity. SQL Server Create Table With Identity Column What is an Identity Column in … Read more

Cannot insert explicit value for identity column in table

Cannot insert explicit value for identity column in table

Recently, I tried force a value into the identity column, SQL Server stoped me with the error Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF. Cannot insert explicit value for identity column in table I was executing the following query. SQL After executing the query above, I got … Read more

SQL Server Change Table Schema

SQL Server Change Table Schema

In this tutorial, I am going to walk you through exactly how to handle these changes with the precision of a seasoned DBA. Whether you are looking to modify a column’s data type using ALTER TABLE or move a table to a completely different security schema using ALTER SCHEMA, I will cover every angle. SQL … Read more

Update Stats on Table SQL Server

Update Stats on Table SQL Server

Statistics are the single most critical component of query performance. They are the “map” that the SQL Server Query Optimizer uses to navigate your data. If the map is wrong, the engine gets lost, and your application performance tanks. In this guide, I will walk you through exactly how to update statistics on a table … Read more

SQL Server In Memory Tables

SQL Server In Memory Tables

As a Database Architect who has spent years optimizing high-concurrency environments, I have seen one feature consistently change the game: SQL Server In-Memory OLTP. But here is the catch: In-Memory tables are not a magic switch you flip to make everything faster. They require a fundamental shift in how you think about data persistence, locking, … Read more