Convert Mysql Create Script To SQL Server Create Script

Mar 29, 2008

Hi guys

Just a quick one. I have some create scripts that were created for mysql and i am wanting to convert them to a

SQL Server create script. I am just wondering if anyone knows of any utilities or codeplex projects, etc that can perform the convert process.



The script is fairly basic but it is not fully compatible but i have a lot of them thus why i want to automate the process. The majority of the script is just table create statements like the following:





Code Snippet
-- -----------------------------------------------------
-- Table `dbo`.`Staff`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbo`.`Staff` (
`StaffId` INT NOT NULL AUTO_INCREMENT ,
`IndividualId` INT NOT NULL DEFAULT 0 ,
`PositionId` INT NOT NULL DEFAULT 0 ,
`EmploymentStartDate` DATETIME NULL ,
`EmploymentEndDate` DATETIME NULL ,
`SupervisorStaffId` INT NULL ,
`TerminatedEmploymentReasonId` INT NULL ,
`DeletedFl` BIT NOT NULL ,
`CreateDateTime` DATETIME NOT NULL ,
`CreateUserId` INT NOT NULL ,
`ChangeUserId` INT NOT NULL ,
`ChangeDateTime` DATETIME NOT NULL ,
`VersionNum` INT NOT NULL ,
PRIMARY KEY (`StaffId`) ,
INDEX Individual_Staff_IndividualId_Ref (`IndividualId` ASC) ,
INDEX Lookup_Staff_PositionId (`PositionId` ASC) ,
INDEX Staff_Staff_SupervisorStaffId_Ref (`SupervisorStaffId` ASC) ,
INDEX Lookup_Staff_TerminatedEmploymentReasonId (`TerminatedEmploymentReasonId` ASC) ,
CONSTRAINT `Individual_Staff_IndividualId_Ref`
FOREIGN KEY (`IndividualId` )
REFERENCES `dbo`.`Individual` (`IndividualId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Lookup_Staff_PositionId`
FOREIGN KEY (`PositionId` )
REFERENCES `dbo`.`Lookup` (`LookupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Staff_Staff_SupervisorStaffId_Ref`
FOREIGN KEY (`SupervisorStaffId` )
REFERENCES `dbo`.`Staff` (`StaffId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Lookup_Staff_TerminatedEmploymentReasonId`
FOREIGN KEY (`TerminatedEmploymentReasonId` )
REFERENCES `dbo`.`Lookup` (`LookupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);







Thanks for the help

Anthony



Note: i know if you have a mysql database you can go from one to the other, but i specifically need to take these mysql create scripts and convert them to sql server create scripts and there are a LOT of them i.e. more than 1000 script files that each contains a couple of hundred table create statements.

View 4 Replies


ADVERTISEMENT

How To Create A Linked Server To MySQL From MsSQL?

Nov 7, 2005

I can create a linked server to another MsSQL from MsSQL,but encounter error when create a linked server to MySQL:
Error 7399:OLE DB provider 'MSDASQL' reported an error.
Data source name not found and no default driver specified.
......

Anyone can help me?
Thanks!

View 6 Replies View Related

How To Run Mysql Create Table Script Into MsSQL

Aug 2, 2006

Dear All,

I have the table creation script and insret record script.
This is MySQl Format.
What changes I have to do so can I run this scripts into SQL Server 2000.
If any body has successfully done it then please tell me the procedure.

CREATE TABLE `activity` (
`id` bigint(20) NOT NULL auto_increment,
`object_type` varchar(60) default NULL,
`object_id` varchar(20) default NULL,
`person_id` bigint(20) NOT NULL default '0',
`activity_dtm` datetime NOT NULL default '0000-00-00 00:00:00',
`activity_type_cd` varchar(25) NOT NULL default '',
`description_code` varchar(200) default NULL,
PRIMARY KEY (`id`),
KEY `FK9D4BF30FB4715636` (`activity_type_cd`),
KEY `FK9D4BF30F270CDEE0` (`person_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `activity`
--


-- --------------------------------------------------------

--
-- Table structure for table `actv_type`
--

CREATE TABLE `actv_type` (
`code` varchar(25) NOT NULL default '',
`description` varchar(100) NOT NULL default '',
`void_ind` char(1) NOT NULL default '',
PRIMARY KEY (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `actv_type`
--

INSERT INTO `actv_type` VALUES ('job_create', 'Created job', 'F');
INSERT INTO `actv_type` VALUES ('job_update', 'Changed job', 'F');
INSERT INTO `actv_type` VALUES ('job_void', 'Voided job', 'F');
INSERT INTO `actv_type` VALUES ('job_activate', 'Activated job', 'F');
INSERT INTO `actv_type` VALUES ('job_deactivate', 'Changed job to deactive', 'F');
INSERT INTO `actv_type` VALUES ('job_appl_create', 'Created application', 'F');
INSERT INTO `actv_type` VALUES ('job_appl_update', 'Updated application', 'F');
INSERT INTO `actv_type` VALUES ('intrv_create', 'Created interview', 'F');
INSERT INTO `actv_type` VALUES ('intrv_update', 'Updated interview', 'F');
INSERT INTO `actv_type` VALUES ('person_update', 'Update person', 'F');
INSERT INTO `actv_type` VALUES ('person_create', 'Create person', 'F');
INSERT INTO `actv_type` VALUES ('company_void', 'Voided company', 'F');
INSERT INTO `actv_type` VALUES ('company_create', 'Created company', 'F');
INSERT INTO `actv_type` VALUES ('company_update', 'Updated Company', 'F');


Thanks in Advance.

View 12 Replies View Related

Convert MySQL To MS SQL Server 2005

Jul 27, 2007

Can anyone recommend me how I can convert MySQL database to MS SQL server 2005 database? I am new to the SQL server 2005. Is there any ODBC I can use? Thanks in advance

View 3 Replies View Related

Combine And Convert Int Fields To Create One Field, Should Be Simple

Oct 19, 2007

I want to combine two of my fields somewhat like when you combine to char fields and concatenate them. But these two fields are int. How do i do that? Here's my query right now:




Code Block
SELECT AutoID,
CONVERT(Varchar(Mars_Calender_Year )+ CONVERT(Varchar(Mars_Calender_Period_Code) as MarsId
FROM NavisionReplication.dbo.Tbl_Mars_Calender
ORDER BY Mars_Calender_Year DESC








what am i doing wrong?

View 5 Replies View Related

Convert MySQL To SQL Server 2005 Express

Oct 3, 2007

I have a database that is in MySQL and would like to import it into SQL Server 2005 Express.

Can this be done? Any tutorials anywhere?

Thanks.

View 7 Replies View Related

Transact SQL :: Create Job Which Automatically Convert Output Into Excel And Send Mail

Oct 31, 2015

I have an existing MS SQL database (2008 R2). I have a very simple SQL script. I need to automate this script means wants to create a job which runs on a Friday basis and save the output results of the query as a excel file and then automatically sends the mail to everyone.

View 9 Replies View Related

Problems On Create Proc Includes Granting Create Table Or View Perissinin SP

Aug 4, 2004

Hi All,

I'm trying to create a proc for granting permission for developer, but I tried many times, still couldn't get successful, someone can help me? The original statement is:

Create PROC dbo.GrantPermission
@user1 varchar(50)

as

Grant create table to @user1
go

Grant create view to @user1
go

Grant create Procedure to @user1
Go



Thanks Guys.

View 14 Replies View Related

Boolean: {[If [table With This Name] Already Exists In [this Sql Database] Then [ Don't Create Another One] Else [create It And Populate It With These Values]}

May 20, 2008

the subject pretty much says it all, I want to be able to do the following in in VB.net code):
 
{[If [table with this name] already exists [in this sql database] then [ don't create another one] else [create it and populate it with these values]}
 
How would I do this?

View 3 Replies View Related

Create Variable To Store Fetched Name To Use Within BEGIN / END Statements To Create A Login

Mar 3, 2014

I created a cursor that moves through a table to retrieve a user's name.When I open this cursor, I create a variable to store the fetched name to use within the BEGIN/END statements to create a login, user, and role.

I'm getting an 'incorrect syntax' error at the variable. For example ..

CREATE LOGIN @NAME WITH PASSWORD 'password'

I've done a bit of research online and found that you cannot use variables to create logins and the like. One person suggested a stored procedure or dynamic SQL, whereas another pointed out that you shouldn't use a stored procedure and dynamic SQL is best.

View 3 Replies View Related

Dynamic Create Table, Create Index Based Upon A Given Database

Jul 20, 2005

Can I dynamically (from a stored procedure) generatea create table script of all tables in a given database (with defaults etc)a create view script of all viewsa create function script of all functionsa create index script of all indexes.(The result will be 4 scripts)Arno de Jong,The Netherlands.

View 1 Replies View Related

Can CREATE DATABASE Or CREATE TABLE Be Wrapped In Transactions?

Jul 20, 2005

I have some code that dynamically creates a database (name is @FullName) andthen creates a table within that database. Is it possible to wrap thesethings into a transaction such that if any one of the following fails, thedatabase "creation" is rolledback. Otherwise, I would try deleting on errordetection, but it could get messy.IF @Error = 0BEGINSET @ExecString = 'CREATE DATABASE ' + @FullNameEXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'CREATE TABLE ' + @FullName + '.[dbo].[Image] ( [ID][int] IDENTITY (1, 1) NOT NULL, [Blob] [image] NULL , [DateAdded] [datetime]NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'ALTER TABLE ' + @FullName + '.[dbo].[Image] WITHNOCHECK ADD CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED ( [ID] ) ON[PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorEND

View 2 Replies View Related

Create Script To Create/Refresh Identical Database

Mar 26, 2008



I'm new to using SSIS and have been reading and learning slowly how to use it. I'm trying to create an identical copy of our database for reporting. I've used the Import/Export wizard, but have had some issues with foreign keys and with sql_variant columns.

I've tried searching for anything but haven't had any luck as of yet. I guess I don't even know where to start or what to look for.

Any help would be appreciated. Thanks!

View 9 Replies View Related

Grant CREATE VIEW, CREATE PROCEDURE ...

Apr 12, 2006

Hi,

I have currently a problem with setting up the permissions for some developers. My configuration looks like this.

DB A is the productive database.

DB B is a kind of "development" database.

Now we have a couple of users call them BOB, DAVID, ...

who are members of the db role db_reader and db_writer for the productive db a but they should be allowed to do nearly everything on db b.

Therefor I added them to the db role db_owner for db b.

For testing purposes I tried to "CREATE" a view TEST as BOB in database B but I received the error message

'Msg 262, Level 14, State 1, Procedure Test, Line 3

CREATE VIEW permission denied in database 'b'.'

I cross checked the permissions on db level and I even granted all available permissions on db level but nevertheless I receive this error message.

What's my mistake?

Of course it worked fine when I give them sysadmin rights but then they have far too much permissions.

Regards,

Stefan

View 8 Replies View Related

Create INDEX Within CREATE TABLE DDL

Jan 27, 2006

Hi Minor and inconsequential but sometimes you just gotta know: Is it possible to define a non-primary key index within a Create Table statement? I can create a constraint and a PK. I can create the table and then add the index. I just wondered if you can do it in one statement. e.g. I have: CREATE TABLE MyT (MyT_ID INT Identity(1, 1) CONSTRAINT MyT_PK PRIMARY KEY Clustered, MyT_Desc Char(40) NOT NULL CONSTRAINT MyT_idx1 UNIQUE NONCLUSTERED ON [DEFAULT])which creates a table with a PK and unique constraint. I would like (pseudo SQL):CREATE TABLE MyT (MyT_ID INT Identity(1, 1) CONSTRAINT MyT_PK PRIMARY KEY Clustered, MyT_Desc Char(40) NOT NULL CONSTRAINT MyT_idx1 UNIQUE INDEX NONCLUSTERED ON [DEFAULT]) No big deal - just curious :D Once I know I can stop scouring BOL for clues. Tks in advance

View 2 Replies View Related

Convert MS Sql To MySql.....???

Mar 23, 2004

Hello there...
Well i want to ask that.... is it posible to Convert MS Sql server Tables/Views + Database to MySql server.....? or is there any software which can automatically convert MS Sql Server database into MySql database.
I'll be REALLY GLAD if someone can please help me asap...
take care...
Regards
Nabeel Qaisar

View 1 Replies View Related

How To Convert The SQL From Mysql To SqlServer

Feb 21, 2006

the below SQL can be run in Mysql
select distinct(entryinfo.entryid),entryinfo.columnid,ent ryinfo.entryname,entryinfo.entryaddr,entryinfo.sta rttime,entryinfo.finishtime
from entryinfo,entryauditbaseplaytimeinfo
where entryauditbaseplaytimeinfo.entryid=entryinfo.entry id and entryauditbaseplaytimeinfo.editoverflag='1'
and (entryauditbaseplaytimeinfo.auditingFlag='-1' or entryauditbaseplaytimeinfo.artauditingflag='-1') l
imit ?,?;
but in MSSQL,it can't,So How to convert?

View 3 Replies View Related

Convert A Sql Express To Mysql

Jun 1, 2006

Hello.

I have created a web site using visual web developer (free download) The website was created using asp.net 2.0. The vwd I have incorporated the cool new roles and membership features of asp.net 2.0. When i did this vwd automatically created a sql express database (aspnetdb.mdf) to hold the login stuff.

I then purchased som e web hosting from a company and found out that they only support MySQL databases.

My questions are;

1. Can anyone tell me the difference between the two types of database (i know what sql express is but am not sure what MySQL is)

2. Secondly, is there a tool or way I can convert the SQL Express database to a MySQL database?



TIA

ICW

View 7 Replies View Related

DDL File To Convert From MySQL To SQLServerXXX

Aug 4, 2006

We want to migrate a mySQL database to sql server 2000 or sql Server 2005. I have been given a DDL file to perform the conversion, but I don't know what to do with the file? Can anyone help me out? From what I can conclude, the DDL files is a script. So how do I run this script? Where do I place the file, before I run it?
Please help !

View 2 Replies View Related

Convert MySQL Script To SQL Server Script

Jul 20, 2005

Hi there,I have a few MySQL scripts that I need to run in SQL Server. However thesyntax is just slightly different and I was wondering if there is a tool outthere that can quickly convert these scripts so that they will work with SQLServer?Anyone have any ideas (other than manually converting them)?Thanks,Wes

View 2 Replies View Related

Linked Server To MYSQL Using OLEDB Provider For MYSQL Cherry

Feb 12, 2007

Good Morning

Has anyone successfully used cherry's oledb provider for MYSQL to create a linked server from MS SQLserver 2005 to a Linux red hat platform running MYSQL.

I can not get it to work.

I've created a UDL which tests fine. it looks like this

[oledb]

; Everything after this line is an OLE DB initstring

Provider=OleMySql.MySqlSource.1;Persist Security Info=False;User ID=testuser;

Data Source=databridge;Location="";Mode=Read;Trace="""""""""""""""""""""""""""""";

Initial Catalog=riverford_rhdx_20060822

Can any on help me convert this to corrrect syntax for sql stored procedure

sp_addlinkedserver



I've tried this below but it does not work I just get an error saying it can not create an instance of OleMySql.MySqlSource.

I used SQL server management studio to create the linked server then just scripted this out below.

I seem to be missing the user ID, but don't know where to put it in.

EXEC master.dbo.sp_addlinkedserver @server = N'DATABRIDGE_OLEDB', @srvproduct=N'mysql', @provider=N'OleMySql.MySqlSource', @datasrc=N'databridge', @catalog=N'riverford_rhdx_20060822'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'collation compatible', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'data access', @optvalue=N'true'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'dist', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'pub', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'rpc', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'rpc out', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'sub', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'connect timeout', @optvalue=N'0'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'collation name', @optvalue=null

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'lazy schema validation', @optvalue=N'false'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'query timeout', @optvalue=N'0'

GO

EXEC master.dbo.sp_serveroption @server=N'DATABRIDGE_OLEDB', @optname=N'use remote collation', @optvalue=N'false'



Many Thanks



David Hills



View 7 Replies View Related

Is The Operation CREATE MINING STRUCTURE And CREATE MINING MODEL Really Useful?

Aug 17, 2006

Hi,

I've tried those two operations in the Management Studio.
Though we can create a mining structure and mining model in Management Studion,
but we cannot process the analysis-service database.

(1) I create only a mining structure through CREATE MINING STRUCTURE.
No error reported. But if I process the analysis-service database in Management Studio I always get error

'Error : The '<mining_structure__name>' structure does not contain bindings to data
(or contain bindings that are not valid) and cannot be processed.

I then tried to create it by creating and running an XMLA script. It was successful.
However, it's much harder to learn XMLA.

If any of you created an analysis-service database in Mgt Studio, and create a mining
structure in the same place using DMX script, can you process the database?

(2) Is there any use of CREATE MINING STRUCTURE operation without binding
to any table? Examples I saw so far did not show relating it to do. In my experience
processing the analysis-service database with that mining structure is doomed to fail.

(3) Is there any way we can create mining structure through CREATE MINING

STRUCTURE operation in Management Studio and use RELATED TO clause

to bind it to any Relationship to an attribute column (mandatory only if it applies), indicated by
the RELATED TO clause

(4) If this is the fact, is there any use of CREATE MINING STRUCTURE operation?
If we use BI Dev Studio, it's much easier to use the wizard.

(5) I found I cannot create a mining model inside a mining structure through operation
CREATE MINING MODEL. If you call that operation, you end up having a mining
model and a mining structure with the same name. I found that in order to create a
mining model inside a mining structure you have to call operation ALTER MINING
STRUCTURE ADD MINING MODEL. Is it true this is the only way?

Thank you,

Bernaridho

View 3 Replies View Related

Cant Create New Database / CREATE DATABASE Permission Denied In Database Master (error 262)

Oct 2, 2007

 
 I am using SQL express and Visual web developer on windows Vista.
When I try to create a new database the following message appears.
 
CREATE DATABASE permission denied in database master (error 262)
I log on to my computer as an administrator.
Help appreciated
 Prontonet
 
 
 

View 4 Replies View Related

Create Table From Text File, Extract Data, Create New Table From Extracted Data....

May 3, 2004

Hello all,

Please help....

I have a text file which needs to be created into a table (let's call it DataFile table). For now I'm just doing the manual DTS to import the txt into SQL server to create the table, which works. But here's my problem....

I need to extract data from DataFile table, here's my query:

select * from dbo.DataFile
where DF_SC_Case_Nbr not like '0000%';

Then I need to create a new table for the extracted data, let's call it ExtractedDataFile. But I don't know how to create a new table and insert the data I selected above into the new one.

Also, can the extraction and the creation of new table be done in just one stored procedure? or is there any other way of doing all this (including the importation of the text file)?

Any help would be highly appreciated.

Thanks in advance.

View 3 Replies View Related

I Have Sql Server Dev Can't Create Db In Vs?

Mar 24, 2007

I have sql server 2005 dev installed. When I click on app_data in vs2005 - and say create new db. It says I need sql server 2005 express installed? Can't you do this with sql server 2005 dev?

View 1 Replies View Related

Can We Create Jobs In Sql Server?

Sep 6, 2007

 Can we create Jobs in Sql Server?

View 3 Replies View Related

How Can I Create A New Db To Run Locally On My Pc Using Sql Server.

Oct 5, 2007

How can i create a new db to run locally on my pc using sql server.I
need also to install a copy of this new db in another pc. Do i need the
sql server installed in the other machine also? I am thinking to create
an application in vb to play with the db. Every time i start the sql
server i see the window telling to connect do database engine, may be i
am wrong but with this window i can create just a db in the server? i
couldn't create a db locally yet, anyone can help me? 

View 4 Replies View Related

Create A New SQL Server Database

Dec 12, 2007

I have Visual Studio 2003 Developer edition installed. The "Create a new SQL Server database" item is not enabled in the server explorer when I right click on connection. Do I have to instal a different version...or is there a common solution for this?
Thank you.
CJG

View 1 Replies View Related

How To Create A Job In Sql Server 2005

May 21, 2008

Hi All,I need to create a job which executes the update query based on a condition i.e., duration between two dates. How shall i create and use that job.Please can anyone help me.Thanks in advance  Regards,Praveen 

View 3 Replies View Related

Create Function In Ms-sql Server 7.0

Aug 5, 2002

how do create function in sql server 7.0

View 1 Replies View Related

How Do I Create A &#34;Cursor&#34; In SQL Server 7.0??

Feb 11, 2000

How do I create a "Cursor" in SQL Server 7.0 that compares an imported table against a exsisting table? Ex. Table1 is my existing table(Destination), Table2 is my imported table(source). I would like to update records in the Destination from the Source but I have to be aware of these three scenarios.

1. If the record exist in the Destination and the Source I will do nothing.
2. If the record exist in the Source and not in the Destination then I will add the record to the destination.
3. If the record exist in the Destination and not in the Source then I will write to the transaction Log.

Note: I am only concerned about updating one column in Destination which matches the only column in the source.

Someone Please help??

View 2 Replies View Related

Create A Table In SQL Server

Apr 14, 2008

From ASP.NET, how to make temporary table in SQL server from select statement which build in a button?
For example, if the user clicks a button a table will create based on statement below:
“Select * from Order where [order by] = ‘Mike Lee’�

View 2 Replies View Related

Create A View In Server

Oct 4, 2014

Trying to create a view in SQL Server 2014, like

create view test
as
select billno, CONVERT(char(10), billdt, 103) from BILL

but view not created, error

Msg 4511, Level 16, State 1, Procedure test, Line 8

Create View or Function failed because no column name was specified for column 2.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved