Generate DDL script for MySQL in Oracle SQL Developer - sql

I made a relational model in Oracle SQL Developer and I want to make tables in MySQL Workbench. I generated the DDL script in SQL Developer and copied it in MySQL Workbench. I found out that the copied queries are not in correct syntax. I tried different options in SQL Developer to generate script and none of them were in MySQL syntax.
Is there a way to generate DDL script from a model, which is made in SQL Developer, for MySQL?

There is no straight query generation for MySQL in oracle SQL developer. You should use such a sites for your purpose to convert them into MySQL syntax or use tools for automatic converting.

Related

Can I use IFDEF commands in SQL scripts to enter engine specific commands?

I have a SQL script to create a SQL Server database. I now want to create the same database using Firebird.
Obviously, I need to change the SQL script in parts to make it work with Firebird. Is it possible to use IFDEF commands (e.g. $IFDEF FIREBIRD ... $ELSE ... $ENDIF) or something similar to stick to one script but to cover the differences between the database engines?

Unable to Import a database from Microsoft SQL Server Management Studio to phpmyadmin

Hey folks, the person I am buildling a website for decided to design their own database. They used Microsoft SQL Server Management Studio to build it and such. Now that they are done with the database they exported it to a text file (Tasks -> Generate Scripts). Now when I try to import the file into phpmyadmin I get 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 '[master] GO /****** Object: Database [Butterbakers] Script Date: 02/15/201' at line 1
The database code is here: http://zamn.pastebin.com/Y3u7MpZ9
phpmyadmin is for MySQL.
Microsoft SQL Server is a different DBMS.
Large parts of the SQL Syntax is DBMS/vendor specific.
The MySQL Workbench has a feature to "Create EER Model from existing Database".
This may be a try but you need a jdbc connection to the MS SQL Server and MySQL...
Converting DDL to a different DBMS is all but easy. And if you're done this doesn't guarantee that an probably already existing application is still working with the other DBMS.
Not switching DBMS and using the free MS SQL Express could be an option.
First decide for a DBMS and restart form zero is surely the cleanest and less painful solution.
With SQL Compare (http://www.red-gate.com/products/sql-development/sql-compare/) and SQL Data Compare (http://www.red-gate.com/products/sql-development/sql-data-compare/) , you can synchronize different DB.

is there a tool to dump a database schema (SQL DDL) to XML?

I'm looking to automatically generate an XML version of a database schema from SQL (Postgres) DDL.
Are there any tools to help with getting from the DDL to XML?
xml2ddl claims to do this, but it fails to connect and seems unsupported since 2005.
You can use the built-in table_to_xmlschema etc.; see http://www.postgresql.org/docs/current/static/functions-xml.html#FUNCTIONS-XML-MAPPING.
Things that spring immediately to my mind:
Liquibase
Schemaspy
SQL Workbench's WbSchemaReport
They don't use a DDL (SQL) script as input but require a database connection.
Have you also researched DbUnit?

generate database & tables schema (ddl) on Oracle pl-sql

Anyone have a PL-SQL statement that i can use to generate database & tables schema for specific database on Oracle 10g? I need the schema in .sql file and if possible compatible with ANSI-92/99 sql implementation, so i can use the generated .sql directly on sql server 2005.
Already heard about exp/imp, but it seems generated dump file, what i need just a simple ddl on .sql file.
Thanks
You could try:
select dbms_metadata.get_ddl('TABLE',table_name,owner)
from dba_tables where owner='schema name';
It returns longs, so you may want to play with the long buffer.
More about dbms_metadata here: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm
If you just need to dump your schema, this free package does a very nice job. We use it in daily production.
http://sourceforge.net/projects/cx-oracletools
If you need to convert from Oracle to SQL Server, this software might do a better job. We've used it to convert between Oracle, MySql, and Postgreqsql.
http://www.spectralcore.com/fullconvert
I wrote oraddlscript which calls dbms_metadata.get_ddl (Pop's answer) for each database object owned by a user and writes the DDL to a file.
Update: Answered comment
Greetings, I'd recomend using Oracle SQL Developer Data Modeler since it's from Oracle, it can read the DDL information directly from the Data Dictionary. It creates an ERD and then you can produce DDL for SQL Server 2000/2005, some versions of DB2 and Oracle 9i/10g/11g.

How can I import a database schema into MS Access 2003 from sql text file?

I have a database schema generated in a text file (DDL - MS Access compliant).
Where is the option in MS Access to import that schema into an empty database ?
I'm not aware of any import for DDL.
However, DDL contains the definition for the schema.
You simply have the execute DDL as you would any query.
Either create a query, put it in sql mode, paste your ddl, and execute
or....
Create a VBA Sub to essentially do the same: currentdb.execute SQL
Good Luck
To execute a SQL DDL in the SQL View of a Query object, you may need to change the Access user interface to ANSI-92 Query Mode. While the 'traditional' query mode (ANSI-89 Query Mode) supports a SQL DDL syntax it is very limited.
The Access database engine can only execute one SQL statement (DML, DDL or DCL) at a time. To execute a SQL script consisting of multiple SQL statement, you need something to parse individual SQL statements, so it really helps if your script has semicolon ; characters separating them, then execute each statement on at a time i.e. synchronously. If you are doing this in VBA code you are better off using ADO because it always uses ANSI-92 Query Mode.
See if this helps: http://support.microsoft.com/kb/180841
I have been very succesful with reverse / forward engineering MS Access databases with Dezign for Databases by Datanamic. It reads all kinds of DDL scripts (from almost all available database) and can translate between different databases. There is a free trial available.