Databases that serve business applications should often support temporal data. For example, suppose a contract with a supplier is valid for a limited time only. It can be valid from a specific point in time onward, or it can be valid for a specific time interval—from a starting time point to an ending time point. In addition, many times you need to audit all changes in one or more tables. You might also need to be able to show the state at a specific point in time or all changes made to a table in a specific period of time. From the data integrity perspective, you might need to implement many additional temporal specific constraints.
There are situations when applications keep the database connection for a long period of time. It seems to be not important. However, if this application makes many connections or there are several applications with such behavior — things are getting worse.
This article is not a tutorial. It describes possible solutions to this issue. As usual, I will be glad to hear any alternative solutions.
There is an information system that I administer. The system consists of the following components:
1. MS SQL Server database
2. Server application
3. Client applications
These information systems are installed on several objects. The information system is used actively 24 hours a day by 2 to 20 users at once on each object. Therefore, you cannot perform routine maintenance all at once. So, I have to «spread» SQL Server index defragmentation throughout the day, rather than defragmenting all the necessary fragmented indexes at one stroke. This applies to other operations as well.
In this article, we will discuss typical errors that newbie developers may face with while designing T-SQL code. In addition, we will have a look at the best practices and some useful tips that may help you when working with SQL Server, as well as workarounds to improve performance.
Sooner or later, a DB administrator would like to have a performance indicator for SQL Server queries. As we all know, running Profiler for 24 hours will lead to a considerable system load and therefore, it cannot be considered an optimal solution for databases used in the 24/7 mode.
So, how can we detect the state of SQL Server queries? How can we run trace for detected query-related problems without the human input?
In this article, I will provide an implementation of the SQL Server performance indicator for queries, stored procedures and triggers, as well as its usage for the trace run. (more…)
The World Wide Web offers a bunch of information on SQL Server index defragmentation or SQL Server index rebuild. However, most of the recommendations refer to databases that have minimum load time (mostly, at night).
And what about databases that are used for both, data modification, and retrieving information on a 24/7 basis?
In this article, I will provide a mechanism for automating SQL Server index defragmentation implemented in a database used in the company I work for. This mechanism allows defragmenting required indexes on a regular basis since index fragmentation takes place constantly in the 24/7 system. Often, this is not enough to perform index defragmentation once a day. (more…)
What are unique key constraints?
A unique constraint is a rule that restricts column entries to unique. In other words, this type of constraints prevents inserting duplicates into a column. A unique constraint is one of the instruments to enforce data integrity in an SQL Server database. Since a table can have only one primary key, you can use a unique constraint to enforce the uniqueness of a column or a combination of columns that do not constitute a primary key.
Creating a unique constraint on a column automatically creates a unique index. This way SQL Server implements the integrity requirement of the unique constraint. Therefore, when attempting to insert a duplicate value into a column, on which a unique constraint is defined, the Database Engine will detect the unique constraint violation and issue a corresponding error. As a result, the row with the duplicate values will not be added to a table.
Recently, I was involved in the development of the functionality that required a fast and frequent transfer of large volumes of data to disc. In addition, this data was supposed to be read from disk from time to time. Therefore, I was destined to find out the place, the way and the means for storing this data. In this article, I will briefly review the task, as well as investigate and compare solutions for completion of this task.
Context of the task: I work in a team that develops tools for relative database development (SQL Server, MySQL, Oracle). The tool range includes both, standalone tools, and add-ins for MS SSMS.
Task: Restoring documents that were opened at the moment of IDE closing at the next start of IDE. (more…)
This article helps to enrich the functionality of SSIS. It is possible for example to set properties in tasks using expressions and we can assign values and create code to enrich the SSIS functionality.
This article is oriented to SSIS developers who have experience with basic tasks, but are not familiar with variables, scripts to enrich the functionality of the SSIS and to provide dynamic functionality.
This time we will talk about SSIS expressions, variables, and loops in SSIS. We will use expressions to set values in tasks using variables. We will also learn to create Script code in C#.
We will first talk about SSIS expressions and then we will use SSIS with the script task. Finally, we will work with Loop containers and the script task.
The focus of this article is going to be on utilizing JOINs. We will start off by talking a bit about how JOINs are going to happen and why you need to JOIN data. Then we will take a look at the JOIN types that we have available to us and how to use them.
JOINs in TSQL are typically going to be done on the FROM line.
Before we are getting to anything else, the real big question becomes — “Why do we have to do JOINs, and how are we actually going to perform our JOINs?” (more…)