Welcome back to our series on programming constructs in T-SQL! In the previous installments, we explored variables, conditional IF statements, loops, and CASE expressions. These tools have helped us write dynamic and efficient SQL scripts. In this third part, we’ll focus on two essential concepts for writing reliable SQL code: Error Handling with TRY…CATCH Blocks and Transaction Management.
Category: Tutorial
Archiving Old Transactions in SQL Server Using PowerShell
Archiving old or obsolete data is an effective strategy to maintain optimal performance. In this post, we’ll explore how to archive old transactions from a SQL Server database using PowerShell. We’ll walk through creating the necessary database and tables, populating them with sample data, executing a PowerShell script to automate the archiving process, and verifying the results.
Exploring Programming Constructs in T-SQL – Part 2: Loops and CASE Expressions
Welcome back to our series on programming constructs in T-SQL! In Part 1 of this series, we explored the fundamentals of variables and conditional IF statements, laying the groundwork for dynamic and efficient SQL scripting. In this second installment, we’ll delve deeper into T-SQL by examining two more powerful constructs: Loops (specifically the WHILE loop) and CASE Expressions. Understanding these constructs will enable you to handle repetitive tasks and implement conditional logic directly within your SQL queries, further enhancing the flexibility and capability of your scripts.
Automating Database Restoration Between SQL Server Availability Groups Using PowerShell
In this post, I’ll walk you through a PowerShell script that automates the restoration of a database from one AG to another. The script handles everything—from performing a COPY-ONLY backup on the source AG to restoring the database on the target AG’s primary and secondary replicas, applying transaction logs, and rejoining the database to the new AG seamlessly.
Efficient Batch Insertion in SQL Server Using ADO.NET and C#
When dealing with large datasets, the efficiency of database operations becomes crucial. Inserting records one by one into a SQL Server database can be time-consuming and resource-intensive. Fortunately, ADO.NET provides a solution in the form of the SqlBulkCopy class. This tool allows for batch insertion of records, significantly improving performance and reducing overhead. In this post, we’ll explore how to use SqlBulkCopy in C# to efficiently insert large volumes of data into SQL Server.
Integrating SSISDB with SQL Server Always On Availability Groups: A Step-by-Step Guide
Incorporating SQL Server Integration Services (SSIS) with Always On Availability Groups (AGs) is not just a routine task but a necessary one to ensure the robustness of your data integration workflows. While SSISDB plays a central role in managing SSIS projects, it doesn’t inherently align with the high availability features provided by AGs. This guide aims to bridge that gap, offering a detailed and practical approach to integrating SSISDB with Always On Availability Groups, tailored to the unique demands of this database.
Enhancing Scalability with Geographic Sharding in SQL Server
Geographic sharding is a strategic approach that enhances performance by distributing a database into smaller, manageable pieces (shards) across various geographic locations. This methodology not only improves data access speeds but also facilitates efficient load distribution and scalability by aligning data physically closer to end-users. This blog takes a look at implementing geographic sharding in SQL Server.
Configuring Your SQL Server Instance via PowerShell
Managing a SQL Server instance can involve various tasks, including setting configuration options to optimize performance and resource usage. Using PowerShell to configure SQL Server instances can provide significant advantages, such as automation, consistency, and the ability to easily script and repeat tasks across multiple servers. This guide will walk you through a PowerShell script that connects to a local SQL Server instance, retrieves current configuration settings, updates these settings, and applies the changes.
GO for it with SQLCMD: Introducing the Modern SQLcmd
Learn how Go-SQLcmd enhances SQLCMD by providing a lightweight and efficient way to manage SQL Server environments using Docker containers. This guide covers the capabilities of Go-SQLcmd, including container creation and database restoration. Follow detailed installation steps and practical usage examples to streamline your SQL Server development and testing workflows. Ideal for developers and database administrators looking for cross-platform solutions.”
Creating SQL Server AGs on Linux: Part 3 – Pacemaker Resources and Constraints
Welcome to the third part of our series on setting up SQL Server availability groups on Linux. In the previous post, we focused on enabling High Availability Disaster Recovery (HADR) on SQL Server and setting up the availability group. This post will guide you through configuring Pacemaker resources and constraints to manage the availability group effectively.