2010-08-18 5 views
2

J'ai une base de données mysql simple. il a 3 tables.migration mysql vers sql server 2008

est ici la create pour eux:

CREATE DATABASE `qcvalues` /*!40100 DEFAULT CHARACTER SET latin1 */ 

CREATE TABLE `batchinfo` (
    `rowid` int(11) NOT NULL AUTO_INCREMENT, 
    `datapath` mediumtext, 
    `analysistime` varchar(50) DEFAULT NULL, 
    `reporttime` varchar(50) DEFAULT NULL, 
    `lastcalib` varchar(50) DEFAULT NULL, 
    `analystname` varchar(150) DEFAULT NULL, 
    `reportname` varchar(150) DEFAULT NULL, 
    `batchstate` varchar(150) DEFAULT NULL, 
    `instrument` varchar(20) DEFAULT NULL, 
    PRIMARY KEY (`rowid`), 
    UNIQUE KEY `rowid_UNIQUE` (`rowid`) 
) ENGINE=InnoDB AUTO_INCREMENT=15771 DEFAULT CHARSET=latin1 


CREATE TABLE `calibration` (
    `rid` int(11) NOT NULL AUTO_INCREMENT, 
    `filename` varchar(100) DEFAULT NULL, 
    `qcname` varchar(50) DEFAULT NULL, 
    `compound` varchar(150) DEFAULT NULL, 
    `response` varchar(50) DEFAULT NULL, 
    `isid` varchar(150) DEFAULT NULL, 
    `isidresp` varchar(150) DEFAULT NULL, 
    `finalconc` varchar(50) DEFAULT NULL, 
    `rowid` int(11) DEFAULT NULL, 
    PRIMARY KEY (`rid`), 
    UNIQUE KEY `rid_UNIQUE` (`rid`) 
) ENGINE=InnoDB AUTO_INCREMENT=708947 DEFAULT CHARSET=latin1 



CREATE TABLE `qcvalues`.`qvalues` (
    `rid` int(11) NOT NULL AUTO_INCREMENT, 
    `name` varchar(50) DEFAULT NULL, 
    `compound` varchar(50) DEFAULT NULL, 
    `rt` varchar(50) DEFAULT NULL, 
    `response` varchar(50) DEFAULT NULL, 
    `finalConc` varchar(50) DEFAULT NULL, 
    `qvalue` varchar(50) DEFAULT NULL, 
    `rowid` int(11) DEFAULT NULL, 
    PRIMARY KEY (`rid`), 
    UNIQUE KEY `rid_UNIQUE` (`rid`) 
) ENGINE=InnoDB AUTO_INCREMENT=463066 DEFAULT CHARSET=latin1; 

je suis en train d'écrire à cette base de données Excel:

Set cn = New ADODB.Connection 
    cn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _ 
     "SERVER=kame1;" & _ 
     "DATABASE=qcvalues;" & _ 
     "USER=root;" & _ 
     "PASSWORD=password;" & _ 
     "Option=3" 
    'lets get the batch info 
    ' 
    ' open a recordset 
    Set rs = New ADODB.Recordset 

ce serait la meilleure façon de migrer l'ensemble de MySQL DB vers le serveur sql ?

+0

Vous pouvez ajouter une instance de serveur lié à l'instance MySQL, créer la base de données sur SQL Server, puis en utilisant la syntaxe SELECT INTO, car il crée une table (à condition qu'il n'existe pas ... –

Répondre

1

Peut-être la mise en place d'une base de données vide dans SQL Server, puis utilisez dans Management Studio l'Assistant Importation pour importer les données et comme un effet secondaire, le cas échéant générer les instructions CREATE TABLE.

Voir the MS documentation on the Export/Import Wizard pour plus de détails

1

Si vous recherchez les instructions SQL pour correspondre à ce que vous avez affiché:

CREATE DATABASE qcvalues 

CREATE TABLE batchinfo (
    rowid int IDENTITY(1,1) NOT NULL, 
    datapath varchar(max), 
    analysistime varchar(50) DEFAULT NULL, 
    reporttime varchar(50) DEFAULT NULL, 
    lastcalib varchar(50) DEFAULT NULL, 
    analystname varchar(150) DEFAULT NULL, 
    reportname varchar(150) DEFAULT NULL, 
    batchstate varchar(150) DEFAULT NULL, 
    instrument varchar(20) DEFAULT NULL , 

    CONSTRAINT [PK_Batch] PRIMARY KEY CLUSTERED ([rowid] ASC) 
) 
  • tiques doivent être citant enlevés
  • état clé primaire ment est différent
  • auto-incrémentée valeur est différente

Rinse + répétition pour vos deux autres tables, et vous êtes bon.

Ensuite, vous aurez besoin d'obtenir un new connection string from Excel suitable for SQL Server.

Questions connexes