dbTalk Databases Forums  

More questions on triggers

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss More questions on triggers in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Dom
 
Posts: n/a

Default Re: More questions on triggers - 04-27-2011 , 09:36 AM






On Apr 27, 10:24*am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Quote:
Dom wrote:
1. *Where are triggers shown on the Object Explorer in SSMS? *I
thought they would be listed under "Programmability ... Database
Triggers" but they aren't there.

No, they're not there. They are listed within each table node, along with
the columns,keys, constraints and indexes.
I guess the thinking is that they are table objects, not database objects,
so just as you don't have a node to show all the indexes in the database,
neither do you have a node to show all triggers. You have to expand the
individual table nodes.



2. *Is there a GUI to create a trigger, like there is to create a
table? *I've been using straight SQL for this.

No. If you right-click a trigger *in the Triggers node and select New
Trigger, it will open a query window with the script from a trigger-creation
template.

3. *How do you modify a trigger? *I've been using sp_helptrigger to
get the trigger name (since I can't find it anywhere in SSMS), and
then sp_helptext to get the SQL of the trigger.

Right-click a trigger in the Triggers node and select Modify
Problems solved! Thanks a bunch. Any idea what the "database
triggers" node is all about?

Reply With Quote
  #12  
Old   
Henk van den Berg
 
Posts: n/a

Default Re: More questions on triggers - 04-27-2011 , 09:41 AM






On 27-04-2011 16:24, Bob Barrows wrote:
Quote:
Dom wrote:
1. Where are triggers shown on the Object Explorer in SSMS? I
thought they would be listed under "Programmability ... Database
Triggers" but they aren't there.

No, they're not there. They are listed within each table node, along with
the columns,keys, constraints and indexes.
There's actually two places where you can find triggers.
1. DML triggers are located under the Table node
2. DDL triggers are located under the Database node

http://www.hvandenberg.net/SSMSTree.jpg shows part of my setup.

Best,
Henk

Reply With Quote
  #13  
Old   
Dom
 
Posts: n/a

Default Re: More questions on triggers - 04-27-2011 , 09:44 AM



On Apr 27, 10:41*am, Henk van den Berg <hvandenb... (AT) xs4all (DOT) nl> wrote:
Quote:
On 27-04-2011 16:24, Bob Barrows wrote:

Dom wrote:
1. *Where are triggers shown on the Object Explorer in SSMS? *I
thought they would be listed under "Programmability ... Database
Triggers" but they aren't there.

No, they're not there. They are listed within each table node, along with
the columns,keys, constraints and indexes.

There's actually two places where you can find triggers.
1. DML triggers are located under the Table node
2. DDL triggers are located under the Database node

http://www.hvandenberg.net/SSMSTree.jpgshows part of my setup.

Best,
Henk
And that answers my last question! Thanks to everyone.

Reply With Quote
  #14  
Old   
Henk van den Berg
 
Posts: n/a

Default Re: More questions on triggers - 04-27-2011 , 11:48 AM



On 27-04-2011 16:44, Dom wrote:

Quote:
And that answers my last question! Thanks to everyone.
Only now does it dawn on me that you were looking for DML-triggers in
your original post.
Since you mentioned the database-trigger, I thought that you were
working on DDL-triggers.

Duh! If only I had realised that earlier, I'd have answered the question
that was being asked...

Reply With Quote
  #15  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: More questions on triggers - 04-27-2011 , 05:02 PM



Dom (dolivastro (AT) gmail (DOT) com) writes:
Quote:
1. Where are triggers shown on the Object Explorer in SSMS? I
thought they would be listed under "Programmability ... Database
Triggers" but they aren't there.
They are shown under the table they belong to. The node under
Programmability is for DDL trggiers.

Quote:
2. Is there a GUI to create a trigger, like there is to create a
table? I've been using straight SQL for this.
That's the way to do it. For both tables and triggers. The Table Designer is
a piece of crap.

Quote:
3. How do you modify a trigger? I've been using sp_helptrigger to
get the trigger name (since I can't find it anywhere in SSMS), and
then sp_helptext to get the SQL of the trigger.
Like any other source code, you should keep your SQL code under version
control. In that case it's simple. You go to your version-control system
and check it out. Yeah, you can script things from the database, but
that is like disassembling your object files to edit your C# code.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.