473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Query regarding Tiggers.

1
Hello,

I am a beginner with sql and have created a trigger for daily transactions for insert and update like :

if (condition)
begin
insert into customerhist(operation) values('insert')
end
else
begin
insert into customerhist(operation) values('update')
end
go.

I wanted to know which of the insert or update query is executed after this trigger is fired, is there any return type or return variable or flag variable I can use to know this ??

Please can someone help me with this.

Happy Thoughts,
Sonaul.
Sonaul@gmail.com
Feb 28 '07 #1
3 2244
Hello,

I am a beginner with sql and have created a trigger for daily transactions for insert and update like :

if (condition)
begin
insert into customerhist(operation) values('insert')
end
else
begin
insert into customerhist(operation) values('update')
end
go.

I wanted to know which of the insert or update query is executed after this trigger is fired, is there any return type or return variable or flag variable I can use to know this ??

Please can someone help me with this.

Happy Thoughts,
Sonaul.
Sonaul@gmail.com
This is bsed on your condition which you provieded in if else, that statement will be executed.
Feb 28 '07 #2
dorinbogdan
839 Expert 512MB
What does the [condition] expression contain?
Feb 28 '07 #3
almaz
168 Expert 100+
Please submit SQL Server version as approaches may significantly differ depending on it.

In SQL Server 2005 try playing with following code inside the trigger:
Expand|Select|Wrap|Line Numbers
  1. SELECT TE.*
  2. FROM sys.trigger_events AS TE
  3. JOIN sys.triggers AS T
  4. ON T.object_id = TE.object_id
  5. WHERE T.parent_class = 0
  6. AND T.name = '<<Your Trigger Name>>'
Feb 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ryan | last post by:
I came across a situation that I've been unable to explain and was hoping somebody had an answer: I had written an update query which was taking about 8 seconds to run and considered it too...
4
by: Steve Oster | last post by:
Hi all, I have to create a query using MS Query, and what I need is beyond my knowledge. I am querying from a list of invoices, and each invoice can have several delivery dates (possibly a...
7
by: stig | last post by:
hi. coming from postgresql, i am used to textual references to most of the things i do with the database. i feel a little lost with all the graphical. i have few questions regarding MS SQL 2000...
4
by: torontolancer | last post by:
Hi there how r u .I would really appriciate ur concern regarding checking out this code. its beind a command button and i am have a combo box selecing a query criteria and then pressing the button...
3
by: tcveltma | last post by:
Hi Everyone, I know there's been a lot of questions regarding the same kind of issue but I haven't been able to find an answer to my specific problem. Basically I have two tables, one table...
4
by: bfoo75 | last post by:
Hi there, I'm new to this forum, but I've come here quite a bit to find solutions to problems other people have encountered... I'm currently trying to query a database up to 5000 times as fast as...
1
by: silpa | last post by:
Hi, I have an SQL query like this select distinct t1.prodID from Table1 t1 left join Table2 t2 on t2.prodID = t1.prodID left join Table3 t3 on t3.serialno = t2.Id and t3.Qty = 0 ...
9
by: Sinner | last post by:
Hi, I have a field name 'USER' in tableMAIN. How do I replace the user names with corresponding user names. I can do that in xl using vlookup but now I'm trying to find a way to do that in...
2
by: gm000 | last post by:
hi thanks for your reply i was very helpful for me regarding this i have a problem which is this i m using this query it works SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.