I would like to know if a trigger / event could be executed when a table is created/altered/dropped etc.

So is it possible or is there some other way of achieving this goal?

thanks

asked 26 Sep '13, 09:02

Robert2's gravatar image

Robert2
91348
accept rate: 0%


No, SQL Anywhere does not support triggers on DDL operations, only DML.

I can't think of anyway to automatically execute a sequence of SQL statements when a DDL operation is performed, but you can always do it manually (i.e. execute the SQL after each create/alter/drop statement).

permanent link

answered 26 Sep '13, 09:06

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

thanks, i didn't think i would be able to, this was going to be used on an application i don't have control over the source so i can't do it manually after each statement. i might just monitor the systable, syscolumn tables for changes.

(26 Sep '13, 09:16) Robert2

The transaction log contains a record of all DDL, and dbtran.exe can be used to read it.

permanent link

answered 26 Sep '13, 09:38

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

So you're thinking of a loop making DBTRAN run "continuously" against the active log (possibly starting with the last checkpoint), and looking for "CREATE ..." in the generated SQL script? And then use these statements as starting point or check the schema for changes?

Or auditing with only the audit type DDL?

Foxhound 4.0 with a "live schema-monitoring" facility?

(26 Sep '13, 09:43) Volker Barth
Replies hidden

I'll let you know after Foxhound 3.0 ships :)

(26 Sep '13, 10:00) Breck Carter
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:

×108
×41
×10

question asked: 26 Sep '13, 09:02

question was seen: 2,585 times

last updated: 26 Sep '13, 10:00