Hi, The Unload Database tool allows selection of data, structure, data/structure of Tables. But I cannot find a way to unload Events, Stored Procedures, Views, or Users unless I do a full unload of the entire database and then manually cut those portions out of the reload file. Does SQL Anywhere offer a tool for this? SPC asked 24 Oct '12, 16:51 spc |
Selecting the objects in Sybase Central and using copy is a fast way to put the SQL definition in the clipboard. One has to be careful btw., because triggers, indexes, ... are missing when you copy a table definition and in my view these "things" belong to a table. answered 25 Oct '12, 05:48 Markus Dütting "because triggers, indexes, ... are missing when you copy a table definition and in my view these "things" belong to a table." It would be great if you could opt to get "everything".
(25 Oct '12, 13:06)
Justin Willey
|
The options -n, -nl, and -no of the utility dbunload can be used to unload database structure informations. answered 25 Oct '12, 05:21 Hartmut Branz |
The data you want is all in the system tables. Here's an example of how to unload the source code for all the stored procedures owned by DBA: UNLOAD SELECT STRING ( '----------------------------------------------------------------\x0d\x0a-- ', proc_name, '\x0d\x0a----------------------------------------------------------------\x0d\x0a', COALESCE ( source, proc_defn ), '\x0d\x0a\x0d\x0a' ) FROM SYSPROCEDURE WHERE USER_NAME ( creator ) = 'DBA' ORDER BY proc_name TO 'c:/temp/procedures.txt' DELIMITED BY '' ESCAPES OFF HEXADECIMAL OFF QUOTES OFF; answered 25 Oct '12, 08:42 Breck Carter Aside: This will unload stored functions as well as procedures and functions are stored in the same system tables (and their entries only differ in details).
(25 Oct '12, 08:52)
Volker Barth
|
Of course, you can also query the system tables to extract the definition of particular events, procedures, views etc.- However, this is usually a bit (but not much) more work than to use dbunload -n.