mysql to sqlserver_MySQL to SQLServer [Express] 2008

MySQL to SQLServer [Express] 2008

08/18/2008

2 分钟可看完

本文内容

Being a historical LAMP guy, the first problem is how do I get my data across?

The release of free SQLServer Express 2008, with the integration with Vista x64, PHP and Visual Studio is an attractive proposition. But: schema and data first.

1. Using PHPMyAdmin, I exported the tables as SQL; and specifically ANSI SQL:

2773883322_8feb0b07b6.jpg

2. Edit the SQL

This is the ugly part. There were four main changes:

Change syntax of the CREATE TABLE to place tables inside the correct namespace (eg: database.dbo.table) and a (ouch) find and replace on INSERTS

Changing the syntax of the PRIMARY KEY

Adding SQLServer Transact SQL (T-SQL) 'go' statements after the table creation and insertion blocks

Changing the column types to match SQLServer types

3. SQLCMD

SQLCMD is the command line interface to your SQLServer instance.

Simply typing SQLCMD –S MAJORSTAR\SQLExpress -E -i export.sql

Where SQLExpress is the instance on a machine called MAJORSTAR, -E to login with my current credentials and -i to run the export.sql file.

With further research, the -d (to set db name) and other like tweaking, the amount of editing as completed in step 2 could have been avoided.

In a few short steps, I had imported my schema and data into SQLServer Express 2008

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值