 |
| 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
|
|
|
|

March 17th, 2007, 12:36 AM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
SQL+Trigger
Dear all,
How could I pass parameter to a trigger?
Any kind of assistence is greatly accepted.
|
|

March 17th, 2007, 07:10 AM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

March 17th, 2007, 08:02 AM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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,
|
|

March 17th, 2007, 05:04 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

March 20th, 2007, 07:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|

March 20th, 2007, 08:06 AM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |