In this article, we will learn how to calculate and add a subtotal in SQL queries.
Read more »SQL commands
A deep dive into SQL Table Variables
July 28, 2021In this article, we will explore some secrets about SQL Table Variables.
Read more »File Validation in SQL Server with xp_fileexist
July 6, 2021In this article, we will explore the xp_fileexist extended stored procedure usage and other details. At the same time, we will take a look at alternative methods to this procedure.
Read more »An overview of the SQL Server ISNUMERIC function
July 2, 2021This article gives an overview of the SQL Server ISNUMERIC built-in system function. It explains how to use this function, illustrates its limitations, and provides some alternatives.
Read more »An overview of the sp_helptext statement
June 28, 2021In this article, we are learning about the sp_helptext statement. I am going to show the various examples of the usage of it. I will also explain the two alternatives of the sp_helptext statement.
Read more »SQL GO command in SQL Server
May 18, 2021Introduction
If you are using SQL Server and saw a GO command in a T-SQL script and you do not know what that GO is used for, this article is for you. In this article, we will explain what the SQL GO command is when to use it, and some tips about using it.
Read more »Learn SQL: How to prevent SQL Injection attacks
May 17, 2021In the previous articles we’ve talked about SQL injection and dynamic SQL but we lacked an answer on how to prevent SQL injection attacks. Today we’ll do exactly that and show you one possible approach to how to do it. We’ll also mention other possible threats and approaches you could take.
Read more »Impact of SQL Variables on Performance
May 10, 2021In this article, we are going to learn how SQL variables negatively affect query performance and also examine the causes of this issue.
Read more »Dynamic Data Masking in Azure Synapse Analytics
April 23, 2021This article will take you through the process to apply Dynamic Data Masking on the dedicated SQL pool of Azure Synapse Analytics.
Read more »Working with parameters in the sp_executesql stored procedure
April 16, 2021This article explains how to use the sp_executesql system stored procedure to run static and dynamic SQL queries and how to pass input and output parameters while using it.
Read more »Stairway to SQL essentials
April 7, 2021SQL Essentials stairway series helps readers understand the most common database language SQL uses for data munging and data wrangling. SQL Essentials articles is a collection of SQL standards and best practices and help you take you in step closer to learn database query.
Read more »Learn SQL: Dynamic SQL
March 3, 2021Dynamic SQL is a programming technique you can use to build SQL statements as textual strings and execute them later. This technique could prove to be useful in some cases and therefore it’s good to know we have it as an option. In today’s article, we’ll show how to create and execute dynamic SQL statements.
Read more »SUBSTRING, PATINDEX and CHARINDEX string functions in SQL queries
March 1, 2021In this article, we will explore SUBSTRING, PATINDEX and CHARINDEX string functions for SQL queries.
Read more »SQL SELECT TOP statement overview and examples
January 25, 2021In this article, we will learn how to use SQL SELECT TOP queries and we will also reinforce this learning using examples.
Read more »An Overview of User-defined SQL Server Types
November 3, 2020In this article, we will explore User-defined SQL Server Types and their usage.
Read more »Learn SQL: SQL Injection
November 2, 2020SQL Injection is a well-known technique used to attack SQL-based applications. In this article, we’ll focus on examples showing how you could exploit database vulnerabilities using this technique, while in the next article we’ll talk about ways how you can protect your application from such attacks.
Read more »Learn SQL: Non-Equi Joins in SQL Server
September 29, 2020Non-Equi join in SQL Server sounds like something abstract (and fancy), but it’s not so abstract (and fancy) at all. The same stands for equi joins. After reading this article, I hope you’ll agree on that with me. Today’ I’ll try to explain what they are and when you should use them. So, let’s start.
Read more »Identify unused tables of SQL databases
September 24, 2020In this article, I am going to demonstrate how we can identify the unused tables of a given SQL Database. As a database administrator, we must maintain the tables and objects of the SQL Database. In my organization, when we add a new column or change the data type of a column, we export the data of the existing table in the backup table. Often, we forgot to review and maintain those backup tables. So as a solution, we decided to create a SQL Job that populates the list of unused tables and email the list to the DBA Team for review.
Read more »Learn SQL: SQL-Related Jobs
September 1, 2020In today’s article, we’ll take a look at 4 common SQL-related jobs and roles and explain what kind of tasks you could expect at each of these roles and what types of queries you’ll possibly use to solve these tasks. If you’re already in any of these roles, you’re probably familiar with this, but if you’re new to the world of SQL, you could find this very useful to decide in which way you want your career to develop.
Read more »T-SQL scripts to copy or remove files from a directory in SQL Server 2019
August 21, 2020Sometimes database professionals need to perform specific tasks at the operating system level. These tasks can be like copying, moving, deleting files and folders. A use case of these tasks might be removing the old backup files or copying backup files to a specific directory after a particular time. In SQL Server, we can use xp_cmdshell extended stored procedure to execute commands directly in the Windows command prompt(CMD). You need a sysadmin role or proxy account configured to use this extended procedure. We can also use the SSIS package for the file transfer, but it also requires you to build a package with the relevant tasks.
Read more »Learn MySQL: Create and drop temp tables
August 18, 2020In this article, we are going to learn how to create a temp table and further drop these tables. The temporary tables are session-specific tables that are created within the session. When the session closes, the table is dropped by itself. A temporary table exists within a session only; therefore, a table created by one session is not visible to another session. For example, Session ID 501 has created a temporary table then session ID 502 cannot access it or manipulate it. Two different sessions can have a temporary table with the same name.
Read more »Diving deep with complex Data Structures
July 29, 2020In my previous article, Understanding common Data Structures, I have mentioned the most commonly used data structures in software programming. In this article, let us get into some more details about the other data structures that are a bit complex than the ones already discussed but also used quite often while designing software applications. Here, we will look into the following data structures.
Read more »Learn SQL: Naming Conventions
July 28, 2020A naming convention is a set of unwritten rules you should use if you want to increase the readability of the whole data model. Today, I’ll try to explain how you should formulate your naming convention and, maybe even more important, why should you do it and what is the overall benefit from using it.
Read more »Understanding the SQL MERGE statement
July 27, 2020In this article, I am going to give a detailed explanation of how to use the SQL MERGE statement in SQL Server. The MERGE statement in SQL is a very popular clause that can handle inserts, updates, and deletes all in a single transaction without having to write separate logic for each of these. You can specify conditions on which you expect the MERGE statement to insert, update, or delete, etc.
Read more »An introduction to SQL tables
July 17, 2020In this article, we will learn the concept of SQL tables and then work on how we can create tables with different techniques in SQL Server.
Read more »