Blog

Page 150 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)

Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)

Published on September 2, 2023

# How to Kill All Connections to a Database So, you're trying to drop a database but keep getting the pesky error message "Cannot drop database 'MyDB' because it is currently in use." Frustrating, right? But fear not, because I'm here to guide you through

Cover Image for Remove all spaces from a string in SQL Server

Remove all spaces from a string in SQL Server

Published on September 2, 2023

## How to Remove All Spaces from a String in SQL Server 2008 Have you ever found yourself in a situation where you need to remove all spaces from a string in SQL Server 2008? šŸ¤” If so, you've come to the right place! In this blog post, we will address thi

Cover Image for T-SQL: Deleting all duplicate rows but keeping one

T-SQL: Deleting all duplicate rows but keeping one

Published on September 2, 2023

šŸ“š**Title: T-SQL: Deleting Duplicate Rows with Efficiency and Ease** Are you struggling with eliminating duplicate rows in your T-SQL table without risking the loss of important data? We've got you covered! In this blog post, we'll guide you through the p

Cover Image for Storing JSON in database vs. having a new column for each key
mysqloptimization

Storing JSON in database vs. having a new column for each key

Published on September 2, 2023

# Storing JSON in Database vs. Having a New Column for Each Key: Which Is Better? šŸ“ As a developer, you may come across a common problem of deciding how to store user-related data in a database. One option is using JSON format to store all the data in a

Cover Image for Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement

Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement

Published on September 2, 2023

# How to Clean up a Database in SQL Server 2005: Drop All Tables, Stored Procedures, Triggers, Constraints, and Dependencies in One Go! šŸš€ So you've got a messy, unused database in SQL Server 2005 that needs cleaning up. You're tired of waiting for your D

Cover Image for How can you represent inheritance in a database?
inheritance

How can you represent inheritance in a database?

Published on September 2, 2023

# How to Represent Inheritance in a Database? šŸ¬šŸ’¾ Have you ever had to store a complex structure in a SQL Server database? šŸ¤” It can be quite tricky, especially when dealing with objects that share common attributes but also have many unique ones. For ex

Cover Image for How do I list all the columns in a table?
mysql

How do I list all the columns in a table?

Published on September 2, 2023

# šŸ“ How to List All the Columns in a Table: A Comprehensive Guide So, you have a database and you're looking to list all the columns in a table. Whether you're a beginner or an experienced developer, this is a common task that can sometimes be a bit tri

Cover Image for Syntax of for-loop in SQL Server
loopssyntax

Syntax of for-loop in SQL Server

Published on September 2, 2023

# šŸ“ Blog Post: Syntax of FOR Loop in SQL Server Welcome, SQL Server enthusiasts! šŸŽ‰ In today's blog post, we'll dive into the exciting world of T-SQL and explore the syntax of the FOR loop. šŸ”„ Whether you're a beginner or an experienced developer, unders

Cover Image for How can I truncate a datetime in SQL Server?
datetime

How can I truncate a datetime in SQL Server?

Published on September 2, 2023

# Truncating a Datetime in SQL Server: Simplified and Speedy! āœ‚ļø Are you tired of dealing with unnecessary time components in your datetime values when working with SQL Server? You're not alone! Truncating a datetime can be a tricky task, but fear not, we

Cover Image for SQL Server: Query fast, but slow from procedure
performance

SQL Server: Query fast, but slow from procedure

Published on September 2, 2023

# šŸ” SQL Server Query Fast, but Slow from Procedure Have you ever experienced a frustrating situation where a query runs fast when executed directly, but becomes painfully slow when executed from a stored procedure? 😫 Don't worry, you're not alone! This