Home Forums SQL Server 2005 T-SQL (SS2K5) DDL Trigger to prevent dropping of a specific table? RE: DDL Trigger to prevent dropping of a specific table?

  • SQL-DBA-01 (4/10/2015)


    HI Lowell,

    Please suggest how to capture DML operation here.

    Thanks

    Sourav

    there is no DML in a DDL trigger...but there is a command text.

    if you mean command from the DDL trigger that is being called, it's in the xml.

    go back to my trigger example and find this line:

    @otext=@eventData.value('data(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]',

    you can then use it elsewhere, since it's in a variable.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!