Trigger On System View

Attempting to create a trigger on a system view, master.sys.server_principals 
but keep receiving the following error:
The object 'sys.server_principals' does not exist or is invalid for this 
operation

Is this not permitted in master?

Basic trigger script for a test follows:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Name
-- Create date: 
-- Description:	
-- =============================================
CREATE TRIGGER sys.logincap 
   ON  sys.server_principals 
   AFTER INSERT,DELETE,UPDATE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    select getdate()

END
GO

0
Utf
12/9/2009 5:19:01 PM
sqlserver.programming 1873 articles. 0 followers. Follow

1 Replies
668 Views

Similar Articles

[PageSpeed] 43

tom,

You cannot create triggers on system views.  But, I suspect that you do not 
need to since you can create DDL triggers.  See:
http://msdn.microsoft.com/en-us/library/ms186406(SQL.90).aspx
http://msdn.microsoft.com/en-us/library/ms189871(SQL.90).aspx
http://msdn.microsoft.com/en-us/library/ms191438(SQL.90).aspx

You will see that you can fire a DDL trigger on CREATE, ALTER, and DROP 
LOGIN.

RLF

"tom" <frosty@nospam.nospam> wrote in message 
news:E02794D3-FAB7-48E0-904B-7F1892793A11@microsoft.com...
> Attempting to create a trigger on a system view, 
> master.sys.server_principals
> but keep receiving the following error:
> The object 'sys.server_principals' does not exist or is invalid for this
> operation
>
> Is this not permitted in master?
>
> Basic trigger script for a test follows:
> SET ANSI_NULLS ON
> GO
> SET QUOTED_IDENTIFIER ON
> GO
> -- =============================================
> -- Author: Name
> -- Create date:
> -- Description:
> -- =============================================
> CREATE TRIGGER sys.logincap
>   ON  sys.server_principals
>   AFTER INSERT,DELETE,UPDATE
> AS
> BEGIN
> -- SET NOCOUNT ON added to prevent extra result sets from
> -- interfering with SELECT statements.
> SET NOCOUNT ON;
>
>    select getdate()
>
> END
> GO
> 

0
Russell
12/9/2009 6:42:45 PM
Reply:

Similar Artilces:

Trigger email
Is there a way that you can have a countdown and when the countdown reaches 0 for it to automaticly send out a email to a certian person? You will first have to determine how you are going to calculate your countdown. Then try the following: Dim strSubject As String Dim strAddress As String Dim strMessage As String Dim blSendEmail as Boolean strSubject = "Countdown reached zero" strMessage = "This is the message that will be the body of the email." If 'This is where you would put the countdown check value' Then ...

Rob...Cost update trigger
I found a post that originally included a cost update trigger that Rob had created. It updates the sales price based on a new cost. I can't get the attachment anymore. Anybody out there have the trigger? Thanks, G E ...

access status bar from View
My status bar object is created in MainFrm.cpp. I need to display information in it from my View.cpp. I'm not quite sure how I should do this. Should I do a SetPaneText in my View. If so how do I do this. Otherwise, should I set some some variable that is accessed from MainFrm? Thanks for the help. -- to reply, remove Big10 from address Andrew, You can access the main frame window from your view: CMainFrame* pFrame = (CMainFrame *)AfxGetMainWnd(); .... and then access your status bar via GetMessageBar. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq What I do is use WM_SETMESSA...

outlook 2007 view
I had Franklin Covey outlook add on software on my old computer and they have a view where you have the calander, inbox, to-do list, and journal all showing on one page so you could see everything and document activity quickly through out the day without opening and closing everything. Is there a way to duplicate this with outlook software. I have tried to use the open the journal in a new window but can't insert just a blank journal page for today into the view. Any ideas would be appreciated. ...

DVD movies from a computer to a TV for viewing?
I hope I'm in the right NP or someone can point me to one. Is there a device that will allow one to send a DVD signal from a PC to a TV for viewing? I am runnng Win7 x64 w/ Media Center and would like to show movies on my TV. On 29/07/2010 in message <1134458F-D104-40F3-BB86-043188A1E6DA@microsoft.com> Artreid wrote: >I hope I'm in the right NP or someone can point me to one. > >Is there a device that will allow one to send a DVD signal from a PC to a >TV for viewing? >I am runnng Win7 x64 w/ Media Center and would like to show movies on my...

Trigger
CREATE TABLE tblA ( Symbol varchar(50) NOT NULL, APIFormat varchar(50) NULL, DataFormat varchar(50) NULL ) I would like to do the following: If a new row is added or APIFormat is edited, and DataFormat is not being updated, I would like to set DataFormat like this: If RIGHT(APIFORMAT,1) = '#', then SET DataFormat = LEFT(APIFORMAT,LEN(APIFORMAT)-1) + '0' If right(apiformat,1) <> '#', then SET DataFormat = APIFORMAT If I do the below trigger, if I don't update DataFormat, it sets it correctly, but...

CPropertySheet with System Menu
I have an application that shows a CPropertySheet as it's only window/dialog. I would like to have a system menu on this window, but am having difficulty in figuring out how to make a system menu appear on a property sheet. I've sub-classed the CPropertySheet class, with some code snippets below. The app shows the property sheet nicely, and I get the minimize button, but I am not getting the system menu. Any ideas on how I can get the system menu to show up? Thanks DanB class CMyPropertySheet2 : public CPropertySheet { public: CMyPropertySheet2(LPCTSTR pTitle, CWnd*...

System administrator #2
System administrator 553 relaying denied What is it and how do I fix it. Set your outgoing authentication. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the SWEN virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Phil Lama asked: | System administrator 553 relaying denied | What is it and how do I fix it. ...

moving rules from one system to another
I have a lot of different rules, and alot of rules that I have exported during different times from different systems and supporting different PST files. I would like to import them into a new PST file. What is the: BEST way of doing this? The EASIEST way of doing this. Where can I find more info about importing rules? I have found that even if the folder exists, if the PST is not the same name nad in the same location, that some time (I have not figured out when, becuase sometimes it seems to work) it leaves the folder to be dragged to empty. Are there any 3rd party utils that will look at...

Exchange System Manager slow to open
It takes my system manger about 3-5 minutes to open. anyone have any idea why this is so. i have my AD dns entries in my TCP\IP properties. I was able to open this program normally before i did a system reload. now it is super slow. ???? help chris holcombc@mail.ecu.edu ...

Does a View have and ID?
I know controls have ID's, Dialogs have ID's, but does a View have and ID? If not, Is there something in CWnd I can use to set an ID for a View? Thanks, -- Tea Ear grey Hot. Tea Ear grey Hot Damn you. Hi, "Computer" wrote: > I know controls have ID's, Dialogs have ID's, but does a View have and ID? > If not, Is there something in CWnd I can use to set an ID for a View? > Yes, controls and dialogs have ids. But these ids may not be always applicable; one may create a button with an ID = 1 hoping that he will not use the id. In other words,having a ...

how do you use a function in a view (access project / adp)
running access 2k adp/project as front-end; and sql-server 7 as back- end. I would like to create my own special function that I can then reference from a view. how do I do this? a function defined in a module, is apparently, not usable from a view. ie: public function myFn( x as integer ) myFn = x * 3.141 + 212 end function select *, myFn( [myTable.xvalue] ) as xAnswer from myTable TIA Create the function in SQL Server. -- Duane Hookom Microsoft Access MVP "Bob" wrote: > running access 2k adp/project as front-end; and sql-server 7 as back- ...

could not unregister BLM trigger
Hello: One of our Dynamics GP 9.0 clients is experiencing an unusual error message when exiting Report Writer and returning to GP. Although the error message is not priventing them from using Report Writer or GP, it is a point of interest. And, I would like to see what can be done to eliminate this message. The message is "Could not unregister the BLM trigger." Does anyone know what this means or how to eliminate it? I do not know, as of yet, if all workstations get this message or if even only just some users get this message. Thanks! childofthe1980s Hi I would sugg...

early in the view
What is the earliest point, in the construction of my view, that I can call GetClientRect( ) or use a device context? I am wanting to initialize some metrics variables, based in part upon screen resolution, i.e. GetDeviceCaps( ). Steve Russell wrote: >What is the earliest point, in the construction of my view, that I can call >GetClientRect( ) or use a device context? > >I am wanting to initialize some metrics variables, based in part upon screen >resolution, i.e. GetDeviceCaps( ). For a plain old window, I'd say WM_CREATE. For a dialog, I'd say WM_INITDIALOG. For ...

console winevents and codepage change on 2 or multi cpu systems
Hey guys, any help would be appreciated. Background: My system basic specs is Windows XP, SP2, VC6. Intel P4 Hyperthreading. This problem occurs only if there is more than 1 cpu(hyperthreading or Dual Xeon). I am using SetWinEventHook to get notification of console winevents. Events 4001h-4007h After I setup the hook, I run several console applications, let's use cmd.exe as an example. all is well, notifications are coming from all the windows and I was happy for a while. Yet... When I run CMD.EXE, and then run "chcp", I get the active codepage. if I try to change it usin...

View Only Admin
I am having problems with the view only admin delegation. I put the appropriate group into the local admin on each exchange box but after a couple of days exchange removes this group. What is causing this and how do fix it so it leaves this security group in there. Thanks for your help -- Justin This can happen due to conflicting policies or rules. Try to enable Auditing for the security log and enable loging for Exchange in system manger and check results. "Justin" wrote: > I am having problems with the view only admin delegation. I put the > appropriate group ...

SQL Triggers in Headquarters
We are planning on implementing RMS and Headquarters for our multiple-store retail sales (do not have it installed yet). We are also going to have a virtual store, which will sell items from our brick-and-mortar store inventory. Without getting into too many details at this time, we have determined that the best way for us to accomplish our business needs is to have an external SQL database which will be used to keep track of brick-and-mortar store inventory and will also be used to record virtual store sales. We would then have triggers on this database and on the Headquarters databas...

Undeliverable message from System Admininstrator
I recently added a new email account to Outlook 2003 (I have successfully added 5 email accounts in the past) ; when I send from the new email account, I receive an immediate reply from System Administrator stating, "Your message did not reach some or all of the intended recipients. 553 Sorry, that domain isn't in my list of allowed rcpthosts." Did you set up SMTP to use authentication? "Lawrence" <Lawrence@discussions.microsoft.com> wrote in message news:4C603F95-CF8E-4005-B6A2-ABC1AF479445@microsoft.com... :I recently added a new email account to...

setiing Folder View to show details
Is there any way to set the Folder View to details for all the folders rather than to tiles in XP? nospam;3370973 Wrote: > Is there any way to set the Folder View to details for all the folders > rather than to tiles in XP? Yes there is. It's really easy to do too. Here's what you do. Go to any folder and set the view to details. Don't close the window (stay in that folder). Go to the "Tools" menu and select "Folder Options". Select the "View" tab. Click the "Apply To All Folders" button under the &q...

Trigger on IVR10015
I'm trying to find a way to capture the actual created date on new items when the item copy function is used (when you use the copy function it stores the created date of the source item as the created date of the new item). We have manufacturing but we don't have the QA module, so I was trying to add a trigger to IVR10015 to put the current date in the QA Start Date field and or the QA End Date field upon insert to IVR10015. When I do that and add a new item I get the message below. How can I tell what the constraint is that is being violated? Any other ideas on how to capt...

app with many view area windows
Hi Is there some good sample that I can write a window app like Visual Studio which have many area view windows docking in the left and right and bottom ? Thank for your teaching . You would need splitters and docking windows. Have a look at this link for a sample: http://www.codeproject.com/KB/toolbars/MFCDockingFramework.aspx -SM If you are creating a new application and you are relatively new to MFC then I'd suggest you use VC2008/MFC/FeaturePack. You can simply use the wizard to create a Visual Studio - like project. There is also a VS sample included with the pack. Bog...

Doc/View Architecture
My application uses the document/view architecture with a CScrollView. How can I access that view or its document from an outside class? See below for basic example of what I have going on: class CRoster { protected: CString person; ... public: void SetPerson(CString data); ... }; class CMyAppView : public CScrollView { ... }; class CMyAppDoc : public CDocument { ... CRoster data; }; void CRoster::SetPerson(CString data) { person = data; /* Here I need to get the view or document. If I get the view, I would: CMyAppView* view = ??? view-&...

Database Queries with database views, that base on many database t
I created 2 database views. Each of them uses 256 database tables. From every database table only one column is used in the select list of the view. Every database table has one column which is used for the join. Each database table has 5 rows. The database tables have not any foreign keys and indexes. Both views works fine. When I use the database views in a query like this: SELECT v1.*, v2.* FROM v1, v2 WHERE v1.id=v2.id I should get 5 rows with 512 columns in the resultset. But I get the following error from the SQL-Server (after about 5 minutes): Msg 8621, Level 17, State 2...

Possible to trigger rules from MSN through VBA?
I understand that it is not possible to apply rules to email that comes in from MSN. In my case, my Outlook 2003 knows about two email sources, a POP3 account and an MSN account. Is it possible to write a VB macro that, upon delivery of an MSN email message, transfers that email message to the top of the POP3 email tree and have the rules execute on it from there? -- Richard Lewis Haggard www.Haggard-And-Associates.com ...

System Jobs for Matchcode update stuck in waiting status
System Jobs for Matchcode update stuck in waiting status. Does anyone know how to resolve this? It seems to be for Leads, Accounts, and Contacts. Also, does this affect workflows? -- Onetreeup The status waiting may indicate the workflow has run into an exception. To view this open the advanced find on the system jobs and add the columns message and error code to the view, this will give any additional information if available. This may help you to resolve the issue. -- Patrick Verbeeten (MCPD) Lead Developer Aviva IT Extended Entity and Plug-in browser: http://www.patrickverbeete...