Announcement

Collapse
No announcement yet.

Syntax to call a SQL SERVER Stored Procedure

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Syntax to call a SQL SERVER Stored Procedure

    Hello.
    I have a procedure UPDATE_FACTORY with parameters (@season, @stockid) in SQL server , do you know how to achieve this task? I have tried sc_exec_sq without success:

    sc_exec_sql("EXEC UPDATE_Factory \'162\', \'MERELLEBLKNAP-S1'\'',$DB_CONN);

    Error
    {SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID}EXEC UPDATE_Factory '162','MERELLEBLKNAP-S1 '{SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END}




  • #2
    Here a Thread for that: http://www.scriptcase.net/forum/foru...tore-procedure

    Comment


    • #3
      You are missing parenthesis on sp params right?. And, I dont remember, but nit sure if Conn param could be a variable
      /Giuseppe

      Professional Scriptcase Services
      Some Customers opinions

      Comment


      • #4
        Originally posted by alvagar View Post
        Alvagar, thanks for the reply, but I was unable to find any answer strictly related to TSQL syntax

        Comment


        • #5
          Originally posted by Giu View Post
          You are missing parenthesis on sp params right?. And, I dont remember, but nit sure if Conn param could be a variable
          Giu, thanks for the answer.
          As long as the conn param , I think you are right, actually I reported here as param, but it is a connection name.

          About the parameters, first of all, I am able to execute the SP inside SQL server management , by invoking
          EXEC UPDATE_Factory '162', 'MERELLEBLKNAP-S1'

          This is why I put the same call inside the code.
          I tried to put parenthesis, but with no success, alway same error as above (enabling debugging ).
          I am sure that it is "only" a problem with syntax, but this is where scriptcase macros are badly documented in my opinion.

          In the past, I was able to call SP without paramters , so I did again.
          I wrote a new store procedure without parameters and I am able to call it, with connection parameter as I said.
          Following is working code

          $CALLPROC="EXEC UPDATE_tradotto_factory_ORDTE_CH" ;
          sc_exec_sql($CALLPROC,"DB_CONN");


          So, I still do not know the syntax in scriptcase to invoce a SQL Server Stored Procedure with parameters.
          Hopefully, the support will read this post.


          Comment


          • #6
            Don't know for SQLSERVER sorry, but in my post you have a complete working sample of working with stored procs (mysql)
            http://www.scriptcase.net/forum/show...0997#post40997
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment

            Working...
            X