oldPadavan
oldPadavan

Reputation: 300

Sybase dump table to sql format

I need to dump a couple of Sybase tables and later restore them on other database server. Unfortunataly I can't use bcp or output statements - table schema from the "new" database contains all columns from "old", but also a couple of additional. Also the order of columns is not the same. I guess I'd need a dump with SQL insert + column names statement, but I can't find it in Sybase docs.

Upvotes: 1

Views: 1735

Answers (1)

Mike Gardner
Mike Gardner

Reputation: 6651

I would really suggest you figure out how to get bcp to work, as it is THE default tool for extracting individual tables from the database.

Assuming bcp is back on the table, there are a couple of options for you.

1 - create a view on your source table that reorders the columns (and shame on the developers for changing column order between versions) in the way that you need. Then BCP out from the view, and you should have what you need (assuming the new columns in the target system allow null values or have defaults assigned.)

2 - BCP out your source table, and BCP it into a temp table on the target system. Then you can use 'select into' to reorder the data, and move it into the target table.

If either of these won't work for you, then you may have to resort to command line trickery to export the data - not ideal, but doable.

Upvotes: 2

Related Questions