Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating DDL 1

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi

Is it possible to generate the DDL for the table creation, ie, pure Create Table commands in one script and generate a separate DDL script which contains all the Create Index, Primary keys etc?

I have been generating the DDL with Right button click on the database name in Sybase Central, but that gives me everything, Create Table, index, constraints etc. I'd like to have the indexes etc separate as I want to create the tables, bcp loads of data in to them and then add the indexes, constraints and primary keys afterwards.

lou

 
Hi Lou
I don't believe that Sybase Central is clever enough.
Choice 1 - use Embarcadero products instead.
Choice 2 - Edit the DDL. If on *nix then use sed to clear all lines with 'go', 'create', 'alter', 'print' etc
HTH

Dickie Bird (:)-)))
 
Thanks for that DickieBird. I've been duly editing the said file in SQL advantage and it's a database with quite a number of tables, indexes etc - quite tedious but has to be done.

lou
p.s. Haven't got any *nix systems here.

 
Hi Lou:

I have two stored procedures that I use extensively for just this purpose:

sp_getddl <tablename>
sp_getidx <tablename>

These appear to do exactly what you're looking for.

You should be able to wrapper calls to these stored procs in some sort of script, so you could hit all the tables in your database, or just specific ones; whatever you need.

I can provide the scripts to you if you'd like -- they're far too big to paste here; send me an e-mail:

jennifer.l.johnson@fmr.com


JenJohnson :)
 
sp_helptext "object"

Will dump the DDL of any create dobject in Sybase.

Hope this helps.


-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR][/COLOR] and
Code:
[/ignore] tags.

Ex:
Code:
SELECT 1 from sysobjects

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top