jojovalenton
10th April 2014, 15:55
hello,

anybody who knows how to run stored proc from LN session and reading parameters from session like @fieldid_f and @fieldid_t? pls help. thanks.

regards,

jojo

vinceco252
10th April 2014, 16:35
You can run command line programs using run.prog(). You may be able to do something with that.

Vince

jojovalenton
10th April 2014, 16:49
hi vince,

thanks for the reply. i read 1 thread using run.prog to run stored proc but it does not specify how the parameters will be picked from the Ln session. if you have any sample scripts to get the params from session passed to the run.prog in os level i would really appreciate. thanks.

regards,

jojo

bhushanchanda
10th April 2014, 17:50
Hi,

You can create a bat file with sqlcmd command at run time with the required parameter and run it using run.prog().

You can google how to run Stored Procedure with parameters using bat file and get a lot of related threads. Here's are two of them.

1 (http://www.dbforums.com/microsoft-sql-server/1673730-execute-stored-procedure-via-batch-file.html)

2 (http://social.msdn.microsoft.com/Forums/sqlserver/en-US/68c168d2-3933-4b41-8f10-45cd9a76d2bd/create-a-batch-file-that-runs-a-stored-procedure-with-input-parameters?forum=sqldatabaseengine)

Else, you can directly run the sqlcmd using run.prog but, it will be safe to run it using bat file as it will be easier to track the errors which you can trace using a redirection operator ">".

I have done it once to trigger mails using sqlmail.

vinceco252
10th April 2014, 19:24
^ What he said.

jojovalenton
13th April 2014, 11:12
hello,

thanks again. i will explore these samples inside the links.

regards,

jojo