.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

creating a trigger

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Sql Server

Dear users,

I ran this to create a trigger but failed with an error below.

CREATE TRIGGER validateLogonTrigger
    DECLARE @time time(0) = getdate()
    IF ORIGINAL_LOGIN() = 'ReportUser'
    AND @time BETWEEN '23:00:00' and '23:30:00'


Msg 15151, Level 16, State 1, Procedure validateLogonTrigger, Line 12
Cannot execute as the login 'logonTrigger', because it does not exist or you do not have permission.

What's wrong and what should I fix?


Thank you for your support



View Complete Post

More Related Resource Links

Problem With Creating Trigger For ToggleButton


Hi everyone

I have created an expander control template.  The idea is that when the togglebutton contained within the expander is checked (clicked first time), the arrow and arrow2 object should have their data property changed.  I am having trouble in creating the triggers.  

Can someone please assist me as to where the triggers should be created.

The xaml code for the triggers are:


<Trigger Property="IsChecked" Value="True">
            <Setter TargetName="arrow" Property="

SQL Server 2008 Error creating trigger


I am working in sqlserver 2008 with SP1.  DB mail is setup and works with no issues.  When creating a trigger am getting the following error:

 Msg 14607, Level 16, State 1, Procedure sysmail_verify_profile_sp, Line 42 profile name is not valid

Not sure where this error is comming from.  Thanks in advance for any help.  The code is below: 

CREATE Trigger TR_BLCargo ON BLCargo


Creating Trigger error


I declared for both @begin_time and @end_time as you see, but why do I get an error saying, 

Msg 137, Level 15, State 2, Line 2
Must declare the scalar variable "@begin_time".
Msg 137, Level 15, State 2, Line 6
Must declare the scalar variable "@end_time".


DECLARE @begin_time datetime
DECLARE @end_time datetime
DECLARE @from_lsn binary(10)
DECLARE @to_lsn binary(10)

-- Set the start time for the CDC query to 2 minutes ago
SET @begin_time = DATEADD(MI, -2, GETDATE())

-- Make a change to the Production.Product table
UPDATE Production.Product
SET Name = 'AWC Logo Cap (XL)'
WHERE ProductID = 712

-- Get the end time for the CDC query
SET @end_time = GETDATE()

-- Wait for 10 seconds to allow the CDC process to record the change
WAITFOR DELAY '00:00:10'

-- Map the time intervals to log sequence numbers for CDC
SELECT @from_lsn = sys.fn_cdc_map_time_to_lsn_(
    'smallest greater than or equal', @begin_time

SELECT @to_lsn = sys.fn_cdc_map_time_to_lsn(
    'largest less than or equal', @end_time

creating trigger in vs2008 using sql express2005 in wesite


iam  developing web page where i want to create trigger on insert command. iam using vs2008 vb.net and in built sql express 2005 which is in app_data..... under this my datbase.mdf i can see tables, views,stored procedures,functions,synonmes,types ,assemblies. but there is no triggers folder. how to craete trigger in this ..please help in this situatn....link or any valuable information.. .

Creating your SharePoint Governance Plan

One of the most common questions that I get from prospects as I'm talking to them about the creation of a governance plan and process is what does it look like. In other words, there are materials available which describe what should be in a governance plan but there isn't a ton of guidance on what the process of creating a governance plan and process are.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Creating an AJAX Repeater in ASP.NET MVC

The "TaskList" is a tried an true example of the most basic thing that you can do in any framework. Unfortunately, I had some problems finding a really good example of all the steps necessary to get a task list to work in ASP.NET MVC 1.0.

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Creating SharePoint items with CreateItemActivity

Instead of creating new list items from code in your workflow you can use CreateItemActivity. CreateItemActivity can be used for creating list items or files. Properties of interest for this activity are the following (most of them are self-explanatory):

Creating an Excel Spreadsheet programmatically using VB.NET

The Interoperability services make it very easy to work with COM Capable Applications such as Word and Excel. This article reveals using Excel from a managed application. Excel is the spreadsheet component of Microsoft Office 2000. The majority of Excel programmatic functionality is exposed through Automation via the type library Excel9.olb. The intention of this article is to express that a managed application can interrelate with Excel as a COM server.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

Creating Dialogs and Ribbon Controls for SharePoint 2010

SharePoint 2010 provides new user interface components, such as server ribbons, and the new dialog platform. As a developer, you can create controls for the server ribbon and dialog boxes for the dialog platform.

Creating a Basic SharePoint Web Part

This programming task includes the steps for creating a basic custom Windows SharePoint Services Web Part. It is a simple Web Part that allows you to change the Web Part's Title property, which is a Windows SharePoint Services WebPart base class property that sets the text in the title bar of the Web Part.

Checklist for Creating SharePoint Web Parts

Use this checklist to assist with the deployment and maintenance of Microsoft SharePoint Products and Technologies Web Parts.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend