2

Is it possible to import a mysql dump to a SQL Server database? I have some syntax problems with it.

I have looked through some articles and none of them had helped

Here is how the dump looks like

CREATE TABLE IF NOT EXISTS `search_by_vehicle` (
`id`                int(11) NOT NULL auto_increment,
`vendor`            varchar(255) NOT NULL,
`car`           varchar(255) NOT NULL,
`year`          varchar(255) NOT NULL,
`modification`  varchar(255) NOT NULL,
`param_pcd`         varchar(32) NOT NULL,
`param_dia`         varchar(8) NOT NULL,
`param_nut`         varchar(32) NOT NULL,
`param_bolt`        varchar(32) NOT NULL,
`tyres_factory`     text NOT NULL,
`tyres_replace`     text NOT NULL,
`tyres_tuning`  text NOT NULL,
`wheels_factory`    text NOT NULL,
`wheels_replace`    text NOT NULL,
`wheels_tuning`     text NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;  

INSERT INTO search_by_vehicle (vendor, car, modification, year, tyres_factory, tyres_replace, tyres_tuning, wheels_factory, wheels_replace, wheels_tuning, param_pcd, param_nut, param_bolt, param_dia) 
VALUES( 'Jaguar','S-Type','3.0i','1998','235/50 R17','245/40 R18|245/35 R19','','7.5 x 17 ET45','8 x 18 ET40|8 x 19 ET40','','5*108','12*1.5','','63.3');
James Z
  • 12,209
  • 10
  • 24
  • 44
omini data
  • 407
  • 7
  • 29
  • 2
    Possible duplicate of [Import MySQL database into a MS SQL Server](http://stackoverflow.com/questions/2621682/import-mysql-database-into-a-ms-sql-server) – Pras Apr 27 '16 at 15:14

1 Answers1

1

You could convert it to SQL Server syntax:

CREATE TABLE search_by_vehicle (
[id]                int NOT NULL identity,
[vendor]            varchar(255) NOT NULL,
[car]           varchar(255) NOT NULL,
[year]          varchar(255) NOT NULL,
[modification]  varchar(255) NOT NULL,
[param_pcd]         varchar(32) NOT NULL,
[param_dia]         varchar(8) NOT NULL,
[param_nut]         varchar(32) NOT NULL,
[param_bolt]        varchar(32) NOT NULL,
[tyres_factory]     varchar(max) NOT NULL,
[tyres_replace]     varchar(max) NOT NULL,
[tyres_tuning]  varchar(max) NOT NULL,
[wheels_factory]    varchar(max) NOT NULL,
[wheels_replace]    varchar(max) NOT NULL,
[wheels_tuning]     varchar(max) NOT NULL,
PRIMARY KEY  ([id])
)  ;  
INSERT INTO search_by_vehicle (vendor, car, modification, year, tyres_factory, tyres_replace, tyres_tuning, wheels_factory, wheels_replace, wheels_tuning, param_pcd, param_nut, param_bolt, param_dia) 
VALUES( 'Jaguar','S-Type','3.0i','1998','235/50 R17','245/40 R18|245/35 R19','','7.5 x 17 ET45','8 x 18 ET40|8 x 19 ET40','','5*108','12*1.5','','63.3');

SELECT *
FROM search_by_vehicle;

LiveDemo

Using:

  • specific tool (for this specific example I used one of online free tool / do not recommend to use online tools when you handle sensitive data)
  • by hand

Keep in mind that it is not always possible to do it 1:1.


It looks like that column wheels_replace has non-atomic data ('8 x 18 ET40|8 x 19 ET40').

It could cause problems when you need to get specific value or need to join.

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275