Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 call sproc from select statement

Author  Topic 

mnymoen
Starting Member

2 Posts

Posted - 2008-08-07 : 10:35:11
What is the best way to call a stored procedure from within another stored procedure based on the result of a select statement. For example.

I would like to call the sproc "sp_test" only if
"select count(*) from test" is greater than 1

I cannot figure out how to do that with case statements

Any help would be greatly appreciated

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-07 : 10:37:33
If exists(Select * from test)
EXEC procedure_name .........


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mnymoen
Starting Member

2 Posts

Posted - 2008-08-07 : 10:41:36
Thanks. For some reason I didn't think I could use if statements.
Go to Top of Page
   

- Advertisement -