Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Conditional SQL Script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-05 : 07:52:13
Den writes "My inexperience will show early, but I believe my question is valid and as "difficult" as the ones I've seen posted thus far.

Imagine a series of ASP forms that run a user through a conditonal set of questions,some of which require validating with external legacy data sources, the end result of which is a set of values that updates a table in the work request database. Depending upon what values are submitted, several actions need to occur on the database server, one of which is an email that is sent to a set of people, exactly who depends again on the values submitted, and contains the data submitted from the form as well as other hyperlink with the embedded ASP parameters to "accept" or verify receipt of the work request. Here is my question:

What is the most efficient way to write a stored procedure/trigger that will grab some (not all) of the fields from the form submitted as well as fields that need to be created dynamically based on the form input, and email them to one of several different email "groups"."

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-05 : 10:35:48
quote:

What is the most efficient way to write a stored procedure/trigger that will grab some (not all) of the fields from the form submitted


I think you've got the concept backwards...you pass information to a sproc (stored procedure), not the other way around...



Brett

8-)
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-05-05 : 10:36:26
You can pass the results of the users interactions to the SP via parameters. For the dynamic entries you may need a pair of parameters - description, input.

You can then use a series of if statements in the SP to update the database. For the dynamically built entries you may need dynamic sql - depends how it is represented in the database.

For entries in a the same table you can use a case statement to conditionally update a field.

For the email see xp_sendmail

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Edited by - nr on 05/05/2003 10:37:10
Go to Top of Page
   

- Advertisement -