Category: SQL Server

Binary Search

One of the most interesting algorithms of research is binary search algorithm. This is the fastest algorithm (algorithm of binary trees apart) to search a data inside a group of elements. In fact it runs in a worst log2(x) comparisions before to find (or not) the data. The only prerequisite is : the set of elements where to search the data must be sorted. Below an example of this algorithm. int binary_search( int arr[], int tot_el, int data ) { /* Declaration and initialization of variables */ int el = 0; int me = 0; int count = 0; /*...

Record data type

In Pl Sql exists a lot of data types : varchar2, number, float, double, boolean, etc, but it may happen that you want to use a structure that contains several types of data, we call it Record type. It’s a simply a new data type. Record type is formed by a group of one or more columns with own name and data type. To create Record type have to use the keyword TYPE so to instruct the compiler about this new data type. There are two ways to create it , the first is at “database level” which can be...

SQL Server Windows Server 2008 R2 – Tools Command Line

Microsoft makes provisions of the tools to perform operations at the command line. The most famous are Robocopy.exe (copy / sync files and folders), Calcs.exe (management of permissions on files and folders), Dnscmd.exe (add / remove DNS records), etc. .. Unlike previous versions, if you need to use these tools on Windows Server 2008 R2 it is not enough to copy the .exe files in your folders: just refer to their aliases, not to the full path. For example, to use the robocopy need to type in shell “robocopy” (with its parameters of course) and not the full path C:...

Windows Server 2008 R2 – Tools Command Line

Microsoft makes provisions of the tools to perform operations at the command line. The most famous are Robocopy.exe (copy / sync files and folders), Calcs.exe (management of permissions on files and folders), Dnscmd.exe (add / remove DNS records), etc. .. Unlike previous versions, if you  need to use these tools on Windows Server 2008 R2 it is not enough to copy the .exe files  in your folders: just refer to their aliases, not to the full path. For example, to use the robocopy need to type in shell “robocopy” (with its parameters of course) and not the full path C:...

Partitioning Table MS-SQL Server 2008.

Starting of 2005 version, was introduced the concept of table partitioning (as in Oracle.) At the time of choosing the type of partitioning, you have to be careful about the choice: LEFT or RIGHT. From my experience I would recommend to use the partitioning Left, or with values ​​less than the value of partitioning. This must be done in order to release (so then archive or delete) the last partition without data handling (which means that there is no operation of read / write disk, which takes time and resources). This is important to reduce the time and easier operation....