Categoria: SQL Server

Binary Search

Uno degli algoritmi di ricerca più interessanti è l’algoritmo di ricerca binaria. Questo è l’algoritmo più veloce (algoritmo di alberi binari a parte) per cercare dati all’interno di un gruppo di elementi. In effetti viene eseguito in un peggior confronto log2 (x) prima di trovare (o meno) i dati. L’unico prerequisito è: l’insieme di elementi in cui cercare i dati deve essere ordinato. Di seguito un esempio di questo algoritmo.int binary_search( int arr[], int tot_el, int data ){/* Declaration and initialization of variables */int el = 0;int me = 0;int count = 0;/* Start program */el = tot_el-1;while (count <=...

Record data type

In Pl Sql esistono molti tipi di dati: varchar2, number, float, double, boolean, ecc, ma può capita di voler utilizzare una struttura che contiene diversi tipi di dati, la chiamiamo tipo Record. È semplicemente un nuovo tipo di dati. Il tipo di record è formato da un gruppo di una o più colonne con proprie nome e tipo di dati. Per creare il tipo di record è necessario utilizzare la parola chiave TYPE in modo da istruire il compilatore su questo nuovo tipo di dati. Ci sono due modi per crearlo, il primo è a “livello di database” che può...

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....