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
  #1  
Old   
Dom
 
Posts: n/a

Default More questions on triggers - 04-27-2011 , 08:02 AM






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.

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

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.

Thanks, Dom

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

Default Re: More questions on triggers - 04-27-2011 , 08:16 AM






On 27-04-2011 15:02, Dom wrote:
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.
That's where they are listed. Did you d a refresh after creating the
trigger?
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.
Don't think so, but using straight SQL for this is a good idea anyway.

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.
alter trigger <triggername> ON DATABASE FOR <ddl_action> AS
print 'this is a database trigger'

See also my answer to 1.


Quote:
Thanks, Dom

Best,
Henk

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

Default Re: More questions on triggers - 04-27-2011 , 08:26 AM



On Apr 27, 9:16*am, Henk van den Berg <hvandenb... (AT) xs4all (DOT) nl> wrote:
Quote:
On 27-04-2011 15:02, 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.

That's where they are listed. Did you d a refresh after creating the
trigger?

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

Don't think so, but using straight SQL for this is a good idea anyway.



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.

alter trigger <triggername> ON DATABASE FOR <ddl_action> AS
print 'this is a database trigger'

See also my answer to 1.



Thanks, Dom

Best,
Henk
Yes, I did a refresh on the "Database Triggers", and each of the
higher nodes, ("Programmability", etc.). Nothing shows up there. I
guess of all my questions, you've answered all, but I still don't see
a list of the triggers. Any ideas?

Dom

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

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



On 27-04-2011 15:02, Dom wrote:
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.

For more info on triggers:

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

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



On 27-04-2011 15:02, Dom wrote:
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.

For more info on triggers see Books OnLine at:

ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/cefa4fc4-b8b9-4cd7-b124-eed5283acbfc.htm

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

Default Re: More questions on triggers - 04-27-2011 , 08:30 AM



On 27-04-2011 15:26, Dom wrote:
Quote:
Yes, I did a refresh on the "Database Triggers", and each of the
higher nodes, ("Programmability", etc.). Nothing shows up there. I
guess of all my questions, you've answered all, but I still don't see
a list of the triggers. Any ideas?
Just to cover all the bases: when you close SSMS and then re-open it, do
they show up?

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

Default Re: More questions on triggers - 04-27-2011 , 08:34 AM



On Apr 27, 9:30*am, Henk van den Berg <hvandenb... (AT) xs4all (DOT) nl> wrote:
Quote:
On 27-04-2011 15:26, Dom wrote:

Yes, I did a refresh on the "Database Triggers", and each of the
higher nodes, ("Programmability", etc.). *Nothing shows up there. *I
guess of all my questions, you've answered all, but I still don't see
a list of the triggers. *Any ideas?

Just to cover all the bases: when you close SSMS and then re-open it, do
they show up?
Nope. I'm really stumped on this.

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

Default Re: More questions on triggers - 04-27-2011 , 08:35 AM



On Apr 27, 9:34*am, Dom <dolivas... (AT) gmail (DOT) com> wrote:
Quote:
On Apr 27, 9:30*am, Henk van den Berg <hvandenb... (AT) xs4all (DOT) nl> wrote:

On 27-04-2011 15:26, Dom wrote:

Yes, I did a refresh on the "Database Triggers", and each of the
higher nodes, ("Programmability", etc.). *Nothing shows up there. *I
guess of all my questions, you've answered all, but I still don't see
a list of the triggers. *Any ideas?

Just to cover all the bases: when you close SSMS and then re-open it, do
they show up?

Nope. *I'm really stumped on this.
Also, as I've indicated before, sp_helptrigger, and sp_helptext work
as expected, so they are getting stored properly.

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

Default Re: More questions on triggers - 04-27-2011 , 08:35 AM



On 27-04-2011 15:34, Dom wrote:

Quote:
Nope. I'm really stumped on this.
That makes two of us.
Is reinstalling the client tools an option?

Reply With Quote
  #10  
Old   
Bob Barrows
 
Posts: n/a

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



Dom wrote:
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.
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.
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.
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.
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.

Right-click a trigger in the Triggers node and select Modify

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.