Category: SQLServer

  • SQL Server Database snapshot as a change control tool

    Microsoft introduced database snapshot in Sql Server 2005. It is used to keep a point-in-time snapshot of the database state at the time the snapshot was taken. It is also good for reporting purposes when database mirroring is implemented, because while a mirroring partner database is not accessible, one can produce a snapshot of that […]

  • SQL code for SQL and Relational Theory

    I am reading SQL and Relational Theory by C. J. Date. Baron Schwartz wrote a nice review for it. I am reading the online version, about half way through, so am not sure if it has an accompanying CD with source code. In any case, if you want to play with some SQL code listed […]

  • Perl script to split sql script into separate files

    Below is a quick script I put together to split one single file that contains many stored procedures into many files that contain just a single stored procedure. It can be easily modified for views, user-defined functions, etc.. Notes: 1. It does put BEGIN and END before and after the procedure creation. Because some script […]

  • Generate insert scripts for SQL Server tables with Perl

    Here is a quick hack with Perl to generate insert statements to reproduce data already exist in a given table. It is similar to results mysqldump generates. A few things worth mentioning here: 1. This script uses a text file, TableList, that contains a list of tables that you want insert statements created. Each line […]

  • Moving data from Sql Server to MySQL

    To move data from Sql Server to MySQL, it is certainly possible to use tools that can make connections to both data stores and manipulate data that way, such as Access, Excel, or SSIS. Here I will introduce a process that does not need any special tools or data drivers. Instead, we can use the […]