Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2007, 12:36 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL+Trigger

Dear all,

How could I pass parameter to a trigger?

Any kind of assistence is greatly accepted.
 
Old March 17th, 2007, 07:10 AM
Authorized User
 
Join Date: Dec 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's not possible in a stored procedure or function sense. Triggers can pull data from the virtual inserted and deleted tables plus any other base table. Therefore, you could read data from a base table that contained lookup data for configuration, etc. An example would be if you wanted the alter or insert data based on the geographic location of the user inserting.

Hope this helps.

Adam Gossage
Lake Wylie, SC, USA
 
Old March 17th, 2007, 08:02 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Agossie,

many thanks to u for this reply. Actually i am facing a problem. The details of the problem is:
If a perticular record is closed, then based on the state like open, close or in process, certain calculation will be done. I want to do this calculation by trigger . Here the problem is I cant specify the perticular record, so i want to pass the paramater to the trigger.

Any help is greatly appreciated.

Thanking you,
 
Old March 17th, 2007, 05:04 PM
Authorized User
 
Join Date: Dec 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure I am following you on the 'not specifying the particular record'. Would you submit an example, even if it is in pseudo-code?

I am sure there is a way to accomplish the task. I just need more details.

Adam Gossage
Lake Wylie, SC, USA
 
Old March 20th, 2007, 07:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Why would you want to do that using triggers? What is that you are looking to do in this case? Can you elaborate as agossage said?

I hope you should be looking for a Stored procedure to do this. Triggers cannot be passed with parameters, and triggers are invoked by either Insert/Update/Delete operations on the table.

How about posting more info on this?

Cheers.

_________________________
- Vijay G
Strive for Perfection
 
Old March 20th, 2007, 08:06 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear happygv and agossage
Probably I have solved the problem. I will send it all of you. i will give the details code here. Just give me some time.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger Problem in sql server monika.vasvani SQL Language 1 March 1st, 2007 07:09 AM
Trigger in SQL Server 2000 deniscuba SQL Server 2000 4 April 1st, 2005 11:37 AM
SQL trigger, rollback , update, limits brucenx SQL Server 2000 1 December 17th, 2004 07:05 AM
SQl Server 2000 Trigger everest SQL Server 2000 5 April 26th, 2004 01:44 AM
Can we stop to fire trigger in SQL Server? vincentc SQL Server 2000 2 November 18th, 2003 12:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.