Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2009
    Posts
    20

    Unanswered: Create Table Triggers

    Is there triggers which will accomodate creation of tables. Say for example
    i have the following table. Registration and it has the field Status. When the status turns Approved. I want to trigger the creation of a table called House Owner with the folllwing attributes.

    TableName HouseOwner

    Attributes NRIC, Address, YrsofOwnership, DateofPurchase

    how do i create the above. Is there a way to actually trigger the creation of a table? pls advise..

  2. #2
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250
    refer DDL triggers in sql 2005.
    Cheers....

    baburajv

  3. #3
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    Quote Originally Posted by Thana16
    Is there a way to actually trigger the creation of a table? pls advise..
    This is a really bad idea for all sorts of reasons. Tables should not need to be created at runtime. Please rethink what you are doing or if you want more help then explain what you are trying to achieve. Why can't you create this table along with the rest of your database?

  4. #4
    Join Date
    Apr 2009
    Posts
    20
    ok i just wanted to clear my doubts, and was expecting some clarification here. as my supervisor keeps mentioning about automated processes for the database, i am just learning to explore on triggers as well now.. thanks for the clarification anyway.. i will create the table as per normal and just use triggers for the insert statement.. that will make more sense.

  5. #5
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    Quote Originally Posted by Thana16
    i will create the table as per normal and just use triggers for the insert statement.. that will make more sense.
    In fact triggers are not generally a good way to implement data manipulation code at all. It's usually much better to put your code in a regular stored procedure, not a trigger. I would recommend a trigger only for operations that do not require data to be modified (a business rule for example).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •