Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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's gravatar image

spc
1699918
accept rate: 0%

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.

(25 Oct '12, 08:00) Volker Barth

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.

permanent link

answered 25 Oct '12, 05:48

Markus%20D%C3%BCtting's gravatar image

Markus Dütting
53641220
accept rate: 30%

edited 25 Oct '12, 05:49

"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.

permanent link

answered 25 Oct '12, 05:21

Hartmut%20Branz's gravatar image

Hartmut Branz
40629
accept rate: 0%

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;
permanent link

answered 25 Oct '12, 08:42

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×48

question asked: 24 Oct '12, 16:51

question was seen: 2,555 times

last updated: 25 Oct '12, 13:07