PDA

View Full Version : run vbscript from an SQL statement


maro
06-30-2003, 04:23 AM
hi,
does anyone know if we can write an SQL statement that will run a vbscript. What i need is to create an SQL trigger that will run a vbscript.

gish
06-30-2003, 11:40 AM
exactly what are you trying to do?

From within SQL and depending on what version you are using. SQL 2000 server allows for user defined functions. Other than that there are obviously SP's. If I can get a better idea of what you are trying to do then I can help.

Are you trying to call vbscript from a SP?

maro
07-01-2003, 12:16 PM
thanx for replying,
what i am trying to do is the following:
i have a table on which i created a trigger that is fired on insert. that is when a record is inserted this trigger must run. i want this trigger to run a vbscript stored locally on the computer. is it possiblea

NoahK1ng
07-04-2003, 01:08 AM
Why don't you use whatever generates the SQL query to also run the script? (I presume you aren't just typing SQL statements directly...)

gish
07-04-2003, 12:04 PM
ok...lets see if I get this straight.

A user is "viewing" your site. He triggers an event, and you want to run a script from his(client) pc?

If that scenario is correct, there is no way of doing it, unless of course the client has IIS installed. And has the appropriate permissions/settings.

This is how it is normally done.
----------------------

function.asp (I use JScript sorry just translate into VB)

<%
/*some jscript codehere
declare SQL'ing stuff here*/

var nSuccess = "";
try(){
nSuccess++;
//successfull
}catch(e){
nSuccess = 0;
//error updating/running SP
}

if (nSuccess){
//call function that needs to run if successfull
}else{
//do something else
}


%>