The easiest way to export data from MS SQL Server to a csv or text file

Run the query (SELECT * FROM tablename) to get all the data in Query Analyzer, then copy and paste the results from there into Excel. Then save as csv file type.

MSSQL

mysqldump — A Database Backup Program for MySQL

 

There are three general ways to invoke mysqldump:

shell> mysqldump [options] db_name [tables]

shell> mysqldump [options] --databases db_name1 [db_name2 db_name3...]

shell> mysqldump [options] --all-databases

In its simplest form, the mysqldump utility can be used like this:

mysqldump –-user [user name] –-password=[password] [database name] > [dump file]

this will include both the schema and data as well.

If you need only the schema use the -d or --no-data option

e.g. mysqldump -d -u root -pp@ssword mydatabase > mydatabase.sql

Reference: MySQL :: MySQL 5.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program

Posted in MySQL. No Comments »

How do I Recompile the MySQL Library to Run Under the Medium Trust Environment in ASP.NET?

Update: You no longer need that if you use the MySQL Connector/Net 5.2 or later.

  1. Download the source code for the MySQL Connector/Net from www.mysql.com.
  2. Extract the contents of the zip file to a local directory.
  3. Open mysql.csproj project file in Visual Studio.
  4. Open the AssemblyInfo.cs file, and add the following code, in the using block, at the top of the file (if it is not already there):using System.Security;
  5. Add the following code to the assembly section of the file:[assembly: AllowPartiallyTrustedCallers]
  6. Recompile the dll.

You may now reference this dll from other projects. When you decide to publish your project to your hosting server, you need to upload this modified version of the dll to your bin directory.

Via How do I Recompile the MySQL Library to Run Under the Medium Trust Environment? - Help Center—Knowledge Base and FAQ

MySQL ASP.NET Tutorial

 

A Step-by-Step Guide To Using MySQL with ASP.NET

 

MySQL 5 C# sample code using ObjectDataSources

MySQL Tutorial from MySQL.com

Installing MySQL on Windows

 

Installing MySQL Community Server on Windows

Via http://dev.mysql.com/doc/refman/5.0/en/installing-cs.html

SQL Server Programming Hacks - 100+ List - Wiki

Ease your SQL Server Management Studio SSMS experience

SQL Server Management Studio Express Utility

In SSMS Tools Pack 1.0  you can find these features:

- Uppercase/Lowercase keywords:

          Set all keywords to uppercase or lowercase letters. Custom keywords can be added.

- Run one script on multiple databases:

          Run selected or full window text on selected databases on the currently connected server.

- Copy execution plan bitmaps to clipboard:

          Copy selected or all execution plans to a bitmap that is saved on the clipboard.

- Search Results in Grid Mode and Execution Plans:

          Find all occurrences of your search string in the execution plans or in the results in datagrid mode.

- Generate Insert statements for a single table, the whole database or current resultsets in grids:

          Generate insert statement from your data.

- Query Execution History (Soft Source Control)

           Save all executed queries to file or database and easily find them.

- Text document Regions and Debug sections

           Add Regions and Debug section in your scripts to ease development experience.

- Running custom scripts from Object explorer’s Context menu

           Speedy execution of custom scripts from Object Explorer’s context menus.

- CRUD (Create, Read, Update, Delete) stored procedure generation:

           Generate Customizable CRUD stored procedures for all tables in your database.

- New query template:

           Create a template that is shown when creating a new query window.

Ease your SSMS experience: SSMS Tools PACK 1.0 is out!

How to Minimize SQL Server Blocking

Blocking occurs when one connection to SQL Server locks one or more records, and a second connection to SQL Server requires a conflicting lock type on the record or records locked by the first connection. This causes the second connection to wait until the first connection releases its locks. By default, a connection will wait an unlimited amount of time for the blocking lock to go away. Blocking is not the same thing as a deadlock.

A certain amount of blocking is normal and unavoidable. Too much blocking can cause connections (representing applications and users) to wait extensive periods of time, hurting overall SQL Server performance. In the worst cases, blocking can escalate as more and more connections are waiting for locks to be released, creating extreme slowdowns. The goal should be to reduce blocking as much as possible.

Via How to Minimize SQL Server Blocking

Troubleshooting Blocking

The first step in troubleshooting a problem is figuring out the cause and type of problem. If you have several phone calls from users whose screens just freeze when they hit the CREATE RECORD button, chances are you have some blocking issues. Fortunately, there are some tools that can help you identify the root of the problem.

Your first line of defense should be the system stored procedures sp_lock, sp_who, and sp_who2. The sp_lock procedure lets you see the type of locks acquired by one, many, or all sessions connected to the server. The syntax is as follows:

Via http://www.informit.com/articles/article.aspx?p=26949&seqNum=1

How do I load text or csv file data into SQL Server?

 

How do I load text or csv file data into SQL Server?

If you need to load data into SQL Server (e.g. from log files, csv files, chat transcripts etc), then chances are, you’re going to be making good friends with the BULK INSERT command. 

The command to bulk insert comma-delimite data would be: 

BULK INSERT OrdersBulk
    FROM ‘c:\file.csv’
    WITH
    (
        FIELDTERMINATOR = ‘,’,
        ROWTERMINATOR = ‘\n’
    )

If the csv file has a header row, try this:

BULK INSERT OrdersBulk
    FROM ‘c:\file.csv’
    WITH
    (
FIRSTROW = 2,
        FIELDTERMINATOR = ‘,’,
        ROWTERMINATOR = ‘\n’
    )

Finally, you can also specify how many errors you want to allow before considering that the BULK INSERT failed.

BULK INSERT OrdersBulk
    FROM ‘c:\file.csv’
    WITH
    (
        FIRSTROW = 2,
MAXERRORS = 0,
        FIELDTERMINATOR = ‘,’,
        ROWTERMINATOR = ‘\n’
    )

Vai How do I load text or csv file data into SQL Server?