You might want to look at the answered 21 Dec '09, 17:22 Bruce Hay |
You can also copy and paste individual database objects from Sybase Central into a text editor (eg notepad) where you get the DDL for that object. answered 09 Nov '09, 18:03 Justin Willey This doesn't work for me. My tool would display DDL to the user based on a database object that they selected. |
I too have wondered if SQL Anywhere had some sort of system procedures to extract DDL from any type of database object. Of course, some of these things can be queried by extracting information directly from the system tables, but that feels a bit hacky. SQL Anywhere does support some ASE procedures which get DDL information for procedures, indexes, and views (sp_helptext), but nothing for tables. As mentioned, you can select any object in Sybase Central and copy the DDL to your clipboard. In your case, this is of no use. With the help of a packet sniffer, I have found that Sybase Central is actually querying the system tables for table/column information and building the DDL itself. Manually building the DDL, or using dbunload, may be your only options. If you're going to use dbunload, yes, you're right, it's overkill. I would suggest perhaps running dbunload only intermittently and storing the results in memcache or some other temporary location. It's extra maintenance and complexity to your program, but should be sufficient unless the table schema changes very often. It would be nice to have system procedures that can retrieve the schema of any object, much like the "copy and paste" functionality within Sybase Central. answered 23 Nov '09, 22:38 Ralph Wissing |
Brad: Ralph's fresh answer prompted me to take another look and read your comments. No, there isn't any facility like what you want, and yes, it is sorely needed. I am personally embarrassed at how difficult it's been over the years to keep Foxhound's schema display up to date with respect to all changes, and I have profound respect for the author(s) of dbunload. I'm guessing you're trying to do the same thing. Suggestion: Describe exactly what you want, and why (make a business case), and post a new question here with the Title "Product suggestion: etcetera". answered 24 Nov '09, 04:38 Breck Carter If memory serves (it often doesn't) the ANSI spec has something to say on this subject... the ANSI standard is like a baseball bat, most useful when you want to hit something with it. |
I've tried to make my own Version Control System inside a database for all db objects and used the following function and view. It's quite old (ASA 8) and not complete (indexes, foreign keys, ...) but it's a start.
I also used it to search for specific code segments, before this functionality was available in Sybase Central.
answered 17 Dec '09, 15:18 Markus Dütting |
The SQL Anywhere dbunload.exe utility can be used to write all the schema to a text file. Use the -n option to do just the schema, not the data. The new -no option sorts the CREATE TABLE statements in alphabetic order. You can do this from Sybase Central, but I'm a command-line kinda guy so I'll let other people talk about the wizards. The following blog post talks about using dbunload to answer "Question: How do I compare the schemas of two SQL Anywhere databases?"... http://sqlanywhere.blogspot.com/2009/10/comparing-database-schemas-improved.html If dbunload-to-text-file is not what you're looking for, maybe you could refine your question (make it more specific... point to the SQL Server feature(s) you are talking about)... or ask it as a new question, the more questions the better. And congratulations on posting the second question! (it's really the first question, if you exclude cheaters like the site administrator, i.e., me :) answered 09 Nov '09, 10:02 Breck Carter 1
I would need to get the DDL for an individual object. dbunload may work but it may be over kill. More information: I'm providing users with a list of database objects (e.g. tables, procedures etc.). They have the ability to click on an object and see the DDL for that object. Procedures is easy, I can get the syntax from system tables. I can also get table syntax from system tables but I would have to really know what I'm doing in order to put it all together. |
While I can not address this issue directly I can discribe what Microsoft has done. The code to provide all of the catalog information including the kind of informaton the poster is interested in has been blackboxed into a class (dll). This DLL is use by the standard management tools to provide schema information in the graphical interface. On the other hand this DLL can be referenced by a program and so you can build your own interface to the catalog tables. This is very handy, when Microsoft changed the default way a schema file was generated. I was able to find an application on Code Project that did most of what I wanted to have it the way it was before the update(sqlserver 2005). The tool had a nifty feature, table and view definition in are generated in dependency order, something the stock tools from MS will not do. Since DBUNLOAD already has all of the code for reading and extracting the information from the catalog tables if this code could be seperated out and made availabe like the code from MS as a dll it would go a long way toward increasing the number of third party tools available for ASA. Sybase should consider doing the same same for ASE. answered 15 Feb '10, 19:54 Jay Turner 1
Hello Jay. Yes, this is the assembly I was talking about. It makes it so easy to get anything from SQL Server. I was hoping the same thing existed for SQL Anywhere (and ASE for that matter). Breck, if you packaged your stuff in an assembly... I would license it. :) @Brad: Still feel free to post your requirements as a product suggestion as Breck has mentioned in one of his answers. That's the best way to take influence on the ASA development:) @Brad: Yes, post a product suggestion here, AND post it on the product futures newsgroup if you want full exposure... after all, SQLA (this site) is still in Beta. Explain exactly what you want, AND give a business case... if you can, give a business case that extends beyond creating a commercial tool for developers... a nice "RFP Checkpoint" justification, for example :) |
There is a simple tool the DDL Extractor which iterates over the entire server, writing ddl scripts to a local directory. http://www.antipodeansoftware.com/Home/Products answered 19 Aug '10, 01:32 uberdarryl |