Creating column through T-SQL

  • Is there any possibility to create columns through TRIGGER?

    I mean to say, if I have table name employee_register where column will be generated in the following way:

    -----------------------------------------------------

    EMPCODE | 8/17/2009 | 8/18/2009 | 8/19/2009 | .....

    -----------------------------------------------------

    EMP001 | 1 | 0 | | .....

    EMP002 | 0 | 0 | | .....

    EMP003 | | | | .....

    .

    .

    .

    -----------------------------------------------------

    ----------------------------------------
    Daipayan
    A Beginner to the World of DBMS!
    ----------------------------------------
  • OOPS, duplicate post. Please answer here

    From BOL:

    Additionally, the following Transact-SQL statements are not allowed inside the body of a DML trigger when it is used against the table or view that is the target of the triggering action.

    CREATE INDEX (including CREATE SPATIAL INDEX and CREATE XML INDEX)

    ALTER INDEX

    DROP INDEX

    DBCC DBREINDEX

    ALTER PARTITION FUNCTION

    DROP TABLE

    ALTER TABLE when used to do the following:

    Add, modify, or drop columns.

    Switch partitions.

    Add or drop PRIMARY KEY or UNIQUE constraints.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply