<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlserver.ro/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Articole</title><link>http://sqlserver.ro/forums/22/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: Data Definition Language (DDL) Triggers</title><link>http://sqlserver.ro/forums/thread/270.aspx</link><pubDate>Sat, 07 Oct 2006 05:23:06 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:270</guid><dc:creator>ggciubuc</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/270.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=22&amp;PostID=270</wfw:commentRss><description>&lt;P&gt;A se vedea si patzania lui Alejandro la &lt;A HREF="/forums/thread/98.aspx"&gt;http://sqlserver.ro/forums/thread/98.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>Data Definition Language (DDL) Triggers</title><link>http://sqlserver.ro/forums/thread/233.aspx</link><pubDate>Tue, 03 Oct 2006 11:11:48 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:233</guid><dc:creator>xmldeveloper</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/233.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=22&amp;PostID=233</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:Arial;mso-ansi-language:RO;"&gt;Data Definition Language (DDL) Triggers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Arial;mso-ansi-language:RO;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Arial;mso-ansi-language:RO;"&gt;Un &lt;STRONG&gt;DDL trigger&lt;/STRONG&gt; (declansator) este activat de instructiuni tip &lt;I style="mso-bidi-font-style:normal;"&gt;&lt;STRONG&gt;CREATE&lt;/STRONG&gt;&lt;/I&gt;, &lt;I style="mso-bidi-font-style:normal;"&gt;&lt;STRONG&gt;ALTER&lt;/STRONG&gt;&lt;/I&gt; sau &lt;I style="mso-bidi-font-style:normal;"&gt;&lt;STRONG&gt;DROP&lt;/STRONG&gt; &lt;/I&gt;atat la nivelul serverului cat si al unei baze de date. Poate fi folosit pentru monitorizare modificarilor intr-o baza de date, blocarea anumitor schimbari sau chiar mentinerea unor standarde de cod in definirea obiectelor. Momentan un DDL trigger este activat doar dupa executia instructiunii DDL – varianta &lt;I style="mso-bidi-font-style:normal;"&gt;&lt;STRONG&gt;INSTEAD OF&lt;/STRONG&gt;&lt;/I&gt; (activare in loc de executia instructiunii DDL) nefiind prezenta in versiunea curenta a SQL Server 2005. Functia &lt;I style="mso-bidi-font-style:normal;"&gt;&lt;STRONG&gt;EVENTDATA&lt;/STRONG&gt;&lt;/I&gt; poate fi folosita pentru a obtine textul complet al instructiunii executate.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Arial;mso-ansi-language:RO;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:9pt;FONT-FAMILY:Arial;mso-ansi-language:RO;"&gt;Exemplu:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;-- blocheaza instructiunea DROP TABLE&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;-- la nivelul bazei de date curente&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;CREATE TRIGGER drop_table_trigger ON DATABASE &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;FOR DROP_TABLE&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;AS &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PRINT 'Operatie interzisa!' &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ROLLBACK&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:8pt;FONT-FAMILY:'Courier New';mso-ansi-language:RO;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Observatii:&lt;/STRONG&gt; &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In cazul in care folositi DDL triggers pentru audit, puteti folosi pentru acelasi scop si Notificari de Evenimente (Event Notifications). Diferenta consta in modul de lucru: sincron pentru un DDL trigger si respectiv asincron pentru notificari. 
&lt;LI&gt;DDL triggers nu functioneaza pentru anumite proceduri sistem ca de exemplu &lt;STRONG&gt;sp_rename.&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item></channel></rss>