HOWTO load mysqldump into ms sql


the best way to create new dump file from mysql database without extended inserts and locks with command

> mysqldump --no-create-info --extended-insert=FALSE --skip-add-locks --single-transaction

If you have already existing SQL file created by mysqldump, it contains by default extended inserts.
You can try following perl script to reformat SQL queries.
>  mysqldum2mssql.pl  mysql_dump.sql  > mssql_dump.sql
#!/usr/bin/perl # MySQL dump was created as # >mysqldump -u USER -p  --no-create-info --extended-insert DB_NAME > mysql_dump.sql while(<>){  if(/^(INSERT INTO .*? VALUES)(.*)$/i){    my $insert_into_table = $1;    my $values = $2;    $insert_into_table =~ s/`//g;        (my $table_name = $insert_into_table) =~ m/INSERT INTO (.*?) VALUES/;          my @arr_values = $values =~  m{         \(                  # opening (          (                  # Start capture             (?:             # non-capturing group                 [^()']+     # ignore inner brackets              |  '[^']*'     # skip all between single quotes             )*              # and repeat          )          \)                  # final )        }gx        ;        foreach(@arr_values){         print "$insert_into_table ($_);\n";         print "GO\n";    }  } } 1;
The resulting SQL file contains single insert per line and GO after each line. The file can be loaded into MSSQL compact edition (CE) with utility SqlCeCmd40

Enjoy!

Programming Microsoft® LINQ

I can recommend to learn Programming LINQ the following book [caption id="" align="aligncenter" width="160"] ISBN 978-0735624009[/caption] Get comprehensive guidance for using the Microsoft Language Integrated Query (LINQ) Project with in-depth insights from two experienced developers. Data-rich applications can be difficult to create because of the tremendous differences between query languages used to access data and programming languages commonly used to write applications. This practical guide covers the intricacies of LINQ, a set of extensions to the Visual C# and Visual Basic programming languages. Instead of traversing different language syntaxes required for accessing data from relational and hierarchical data sources, developers will learn how to write queries natively in Visual C# or Visual Basic helping reduce complexity and boost productivity. Written by two experienced developers with strong ties to developer teams at Microsoft, this book describes the LINQ architecture and classes, details the new language features in both C# and Visual Basic, and provides code samples in both languages.
Key Book Benefits:
Delivers an in-depth guidance for using LINQ
Covers architecture, syntax, and classes, illustrating how developers can integrate LINQ into their toolkits
Features code samples in Visual C# (plus Visual Basic in some chapters)

TABLE OF CONTENTS

PART I - LINQ Foundations
1 LINQ Introduction 2 LINQ Syntax Fundamentals 3 LINQ to Objects PART II - LINQ to Relational Data
4 LINQ to SQL: Querying Data 5 LINQ to SQL: Managing Data 6 Tools for LINQ to SQL 7 LINQ to DataSet 8 LINQ to Entities PART III - LINQ and XML
9 LINQ to XML: Managing the XML Infoset 10 LINQ to XML: Querying Nodes PART IV - Advanced LINQ
11 Inside Expression Trees 12 Extending LINQ 13 Parallel LINQ 14 Other LINQ Implementations PART V - AppliedLINQ
15 LINQ in a Multitier Solution 16 LINQ and ASP.NET 17 LINQ and WPF/Silverlight 18 LINQ and the Windows Communication Foundation PART VI - Appendixes
A ADO.NET Entity Framework B C# 3.0: New Language Features C Visual Basic 2008: New Language Features

HOWTO split OTRS into two instances

sometimes you need to split OTRS into two or more instances. You can just backup/restore database,
copy all OTRS files. Change paths, change SystemID and so on!
What to do with articles stored on file system. Should I copy all 20 GB also?
Not really! I can move only necessary files.

First of all let's create directory structure on new instance. SQL can help us with query


SELECT distinct DATE_FORMAT(create_time, 'mkdir %Y\\%m\\%d') a FROM ticket  


save output into batch file and execute it in the directory /otrs/var/article/

Next step to select all articles. Let's suppose we want to move queues with IDs 1,3,5,10 etc.
SELECT CONCAT(DATE_FORMAT(a.create_time, 'move %Y\\%m\\%d\\'),convert(a.id,char(20)), ' C:\\path_to_new_OTRS\\var\\article\\',DATE_FORMAT(a.create_time, '%Y\\%m\\%d\\')) a 
FROM article a JOIN ticket t  ON t.id=a.ticket_id
WHERE  t.queue_id in (1,3,5,10); 


save output again into batch file and execute it in the directory /otrs/var/article/

Enjoy!

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.