0

I have been suffering problems when trying to upload my database onto the webhost I've chosen using phpmyadmin.

Initial problems have included the mdf file not running correctly. In order to solve this it was suggested that I should try using an sql file. Makes sense. So, I generated the sql file using SQL Server Management Studio and tried to upload this....It never gets past the first character before returning a 1064 error message.

I have since tried to just run a single sql command to see if this works

CREATE TABLE [fixtures_Data](
[Id] [uniqueidentifier] NOT NULL,
[Year] [int] NOT NULL,
[Date] [date] NOT NULL,
[Home] [bit] NOT NULL,
[Against] [nvarchar](50) NOT NULL,
[FirstTeam] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

This creates the following error

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[fixtures_Data](
[Id] [uniqueidentifier] NOT NULL,
[Year] [int] NOT NULL,
' at line 1 

I'm assuming that the sql file creating in Studio has some significant syntax errors. Is there a way of creating an sql file in Studio that phpmyadmin can understand?

Chris Harland
  • 456
  • 3
  • 16
  • You say you are trying to use phpmyadmin which is used for MySQL administration yet you are generating the SQL with SQL Server Management Studio? The two types of SQL are fairly different, hence the errors. – Jayden Meyer Jun 03 '14 at 12:57
  • Because phpmyadmin has the MSSQL option I thought that I would be able to import this through, no problem. Obviously not. – Chris Harland Jun 03 '14 at 13:30

2 Answers2

0

There are many differences between MS SQL and MySQL. For one, MySQL doesn't have the uniqueidentifier type, which is why you're getting that error.

There are many tools for converting a database from MS SQL to MySQL. One is MySQL's Workbench

http://www.mysql.com/products/workbench/

But there are also many other methods too. There are several detailed in this answer:

How to export SQL Server database to MySQL?

Community
  • 1
  • 1
RyanB
  • 757
  • 4
  • 11
0

Between [id] and [uniqueidentifier] you should put some datatype. Probably [int] would do.

hy-soft
  • 163
  • 2
  • 12