SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Tracking "Insert into"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starlet_GT
Yak Posting Veteran

Pakistan
81 Posts

Posted - 02/25/2013 :  00:56:43  Show Profile  Reply with Quote
Hi,
I have a sql server 2008R2, i have provided a login someone within a domain with write-only access, now I want to trigger a sql server agent job whenever a "insert into" query sucessfully executed by that login.

please help in this regard.

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/25/2013 :  01:05:52  Show Profile  Reply with Quote
do you mean you need to do trigger action only for specified login?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Starlet_GT
Yak Posting Veteran

Pakistan
81 Posts

Posted - 02/25/2013 :  01:20:26  Show Profile  Reply with Quote
Yes

How to do it in SQL Server 2008, if you have any example then it will be appriciated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/25/2013 :  02:01:48  Show Profile  Reply with Quote
nope. you can do that

however what you can do instead is to add a trigger and do a check inside to see if login is your required login and then do corresponding actions.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Starlet_GT
Yak Posting Veteran

Pakistan
81 Posts

Posted - 02/25/2013 :  02:03:58  Show Profile  Reply with Quote
I have created a trigger but the insert command is not working when trigger is active ... unable to figure it out why it is happening.

Any one please help, i am new in triggers.
Go to Top of Page

Starlet_GT
Yak Posting Veteran

Pakistan
81 Posts

Posted - 02/25/2013 :  02:16:15  Show Profile  Reply with Quote
Following are the lines if i modify the trigger, if this is active than the insert into command is not working.

USE [DB NAME]
GO
/****** Object: Trigger [dbo].[SMSC] Script Date: 02/25/2013 12:11:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[DB NAME]
ON [dbo].[tABLE NAME]
AFTER INSERT
AS
BEGIN

END
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/25/2013 :  04:10:12  Show Profile  Reply with Quote
what is active? didnt get that part.

i cant see any insert into command also

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000