Creating Triggers using DDL deletes other system objects

Discussion in 'microsoft.public.sqlserver.programming' started by Garrett Kunimura, Jul 6, 2005.

  1. I am wondering if anyone else had the problem of trying to create a trigger
    through Query Analyzer and, once executed, it can either wipe out data from a
    table or drop foreign key constraint objects? If so, how would I resolve
    this problem? My company is currently using SQL Server SP4.
     
    Garrett Kunimura, Jul 6, 2005
    #1
    1. Advertisements

  2. Garrett Kunimura

    David Portas Guest

    What makes you think the trigger is responsible? Post the trigger code if
    you want us to take a look.
     
    David Portas, Jul 6, 2005
    #2
    1. Advertisements

  3. Because, when the statement to create the trigger is executed, we immediately
    see the consequence of that action. We are trying to create a trigger that
    just updates a date column in a table -- that's all. Only one programmer is
    touching these tables, so it's not like someone else did something that
    screws around with the data or database structure...
     
    Garrett Kunimura, Jul 6, 2005
    #3
  4. Also, the reverse can be true: Creating a foreign key constraint can drop a
    trigger... Don't know why that happens...
     
    Garrett Kunimura, Jul 6, 2005
    #4
  5. I've never seen or heard about such. In all cases where "thins disappears" it is either errors (in
    code, possibly trigger code, by user) or someone forgot to commit.
     
    Tibor Karaszi, Jul 6, 2005
    #5
  6. That shouldn't happen either. Can you reproduce this? Can you post code we can run that reproduces
    this?
     
    Tibor Karaszi, Jul 6, 2005
    #6
  7. Because, when the statement to create the trigger is executed, we
    This sounds like the twilight zone. Absolutely no other person or
    application in your entire organization has access to this database?

    Like David suggests, post the code and provide a repro. Otherwise, there is
    not much we can do to prove, disprove, laugh at or explain your theory
    except rely on your testimony.
     
    Aaron Bertrand [SQL Server MVP], Jul 6, 2005
    #7
  8. Garrett Kunimura

    JT Guest

    Examine your DDL script closely and make sure it doesn't drop/recreate the
    table. Also, I've seen cases where a buggy insert or update trigger would
    prevent records from being inserted or updated.
     
    JT, Jul 6, 2005
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.