Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run stored procedure 1

Status
Not open for further replies.

ryupb

MIS
Aug 31, 2004
25
US
ok, here is another dumb question.... how can I execute a SQL stored procedure with a parameter??

the stored procedure is in the SQL server database and not the ones in the .DBC
 
It depends on how you are connected - ODBC or ADO. The SQLEXEC( ) Function Help File extry shows these examples:
Code:
* Call a stored procedure with no parameters.
   SQLEXEC(m.lnConn, 'sp_who', 'activeusers')
   BROWSE 

   * Execute stored procedure with an INPUT parameter.
   SQLEXEC(m.lnConn, 'exec byroyalty ?lnPercent','HalfOffAuthors')
Rick

 
Hi Rick,

with regards to the connection, does it differ if i were to use ADO or ODBC connection??

with regards to the parameters that you have stated above, the 'activeusers' - is this the name of the table where the records are supposed to be extracted from??
 
Yes, SQLEXEC() is strictly for ODBC - almost everything is different in ADO. :-(

No, in that example, it's assumed that the stored procedure sp_who, will return a cursor, and it's name will be 'activeusers'.

The stored procedure always knows what table(s) it'll be using - unless the table name(s) are passed in as a parameter.

Rick

 
hey Rick, thanks for the clarification..... fortunately I now remember how to invoke it, just needed some refresher...

a star for your time and effort...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top