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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to use a case statement to then execute a procedure?

Status
Not open for further replies.

sonname

Programmer
May 18, 2001
115
US
For example something like

SELECT CASE @type
WHEN 25 THEN exec proc
END
Or is there something similar like this. I hate to write if statements to do this.
 
No. Use If/Else block to do something like this.
Code:
Declare 
     @type Int
     Set @type = 27
     If @type = 25
           Exec sp_help YourTable
     Else 
	   Print 'Value for Type is ' + Convert(Varchar(5), @type)

Regards,
AA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top