Call a Stored Procedure within an SQL statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #1

    Call a Stored Procedure within an SQL statement

    Hi All,
    I created a stored procedure which updates a specific row whose row ID is passed.
    But what I want to do now, (which is a one time requirement) is to update all rows
    is it possible to call this stored procedure within an sql statement and pass each row ID to it?

    (would i have to go to cursor approach -- damn will have to learn that )
    thanks
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by Shashi Sadasivan
    Hi All,
    I created a stored procedure which updates a specific row whose row ID is passed.
    But what I want to do now, (which is a one time requirement) is to update all rows
    is it possible to call this stored procedure within an sql statement and pass each row ID to it?

    (would i have to go to cursor approach -- damn will have to learn that )
    thanks
    You can call a function from a SQL statement and not a STORED PROCEDURE.

    Restrictions on calling a Function from a SQL statement:

    1. Function should not have RETURN TYPE as BOOLEAN
    2. Function should not perform any side effects. (ie No DML operations)

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Originally posted by Shashi Sadasivan
      Hi All,
      I created a stored procedure which updates a specific row whose row ID is passed.
      But what I want to do now, (which is a one time requirement) is to update all rows
      is it possible to call this stored procedure within an sql statement and pass each row ID to it?

      (would i have to go to cursor approach -- damn will have to learn that )
      thanks

      if it's a one time thing, can you just write a query in query analyzer to update the field you need? what field are you updating? what kind of update?

      Comment

      Working...