Transact SQL - Information Schema - tsql

Is there a way to query an Information Schema from DB2 and dump the contents(tables - structure only),into another database? I'm looking for a way to create a shell model of a database schema from DB2 into a SQL Server database?
Thanks

You can use db2look to get the table structure (DDL) out of db2.
Once you've got it, however, I'm afraid you'll have to manually replace any db2-specific syntax (datatypes, storage parameters, etc.) with it's corresponding SQL Server syntax.
It doesn't look like Microsoft's Migration Tool works for db2 yet. :(

Related

create a database in pyspark using Python API's only

I'm unable to locate any API to create a database in pyspark. All I can find is SQL based approach.
catalog doesn't mention a python method to create a database.
Is this even possible? I am trying to avoid using SQL.
I guess it might be a suboptimal solution, but you can call a CREATE DATABASE statement using SparkSession's sql method to create a database, like this:
spark.sql("CREATE DATABASE IF EXISTS test_db")
It's not pure PySpark API, but this way you don't have to switch context to SQL completely, to create a database :)

SQL to list tables in a dashDB schema

I need to list all of the tables in a schema in dashDB (Db2 Warehouse on Cloud on IBM Cloud).
Is this possible using just a SQL statement or do I need a CLI tool for this?
If it is possible using a SQL statement, please let me know what it is.
Please DON'T provide the CLI statement.
The following should do:
select tabname from syscat.tables
where tabschema='yourSpecificSchemaName'
Note that information like the above can be found in the Knowledge Center for dashDB in the roadmap to catalog views. The view used above is SYSCAT.TABLES.

DB2-clob data to PostgreSQL

We are planning to move data in DB2(28) to PostgreSQL(9.2).
We have already created database schema and tables in PostgreSQL. I am able to do data export from DB2 to csv format.
For importing data in PostgreSQL, the docs say "Copy command" which copies data from a file to the table.
In DB2, if data is of CLOB type, then separate file is created where CLOB data is kept. The main (data.csv) file contains references to CLOBs. How to import CLOB data in such cases?
I searched on net but could not find any opensource tool from PostgreSQL.
This is not a ready-to-use solution but may be a starting point. As far as I remember, DB2 is offering a ODBC interface. On the other hand on PostgreSQL you are able to "import" ODBC databases via Foreign data wrapper.The first step can be found at documentation. May be worth a try.

How to feed a DB PostgreSQL/PostGIS through data that are in Informix DB?

I do not have much experience in postgresql but would like some clues on how to do the following:
I intend to feed a DB PostgreSQL/PostGIS through data that are in Informix DB, which I have access via ODBC.
In short, I intend to do a "select" in Informix DB and be able to import that information directly into a DB PostgreSQL/PostGIS.
From what I understood it seems possible to do it via DBLink. Is that so?
Where can I get detailed information about this process?
I would suggest dump the data from whatever DB you have in text format like CSV, then use COPY command to load the data into PostgreSQL.

How to obtain the database schema from a Sybase ASA 11 Database

I am working on a project where I need to programmatically validate and/or compare a database schema between product releases.
I am using Perl and am looking for a cross-platform method to collect the database schema. I am currently able to perform database queries by utilizing the dbisql.exe command and then parsing the results.
I am wondering if there is potentially a stored procedure or set of queries that I can run to collect the database schema.
It appears that the dbunload.exe command could be used to generate a SQL regeneration script however I am thinking that this output may be difficult to parse.
Any feedback would be greatly appreciated.
If you would like to retrieve the DB schema data on a really low level you could query the corresponding system tables. They are in the SYS-Namespace, especially SYSTABLE (for all tables) and SYSCOLUMN for all fields in those tables.
Check the ASA SQL Reference Handbook for the schema of those system tables.
With Perl's DBI you can easily fire queries on those tables. But you will have to create some local storage for the schema to compare the query results with.
Sybase Central v3.0 has the possibility to export DDL with all DB objects;
and I think SC v6.0 can't connect to ASA 11 :(