TroyMcClure
Technical User
I've seen examples of a CASE statment for Select statements, but I want to control logic flow, here's a simple pseudo code:
Select Case @DoWhat
Case 'update'
Update tblTest Set kang = 'testing';
case 'delete'
Delete from tblTest Where kang = 'testing';
case 'insert'
Insert into tblTest (kang) Values('hello');
case Else
--do something else
End Select
I've tried all manner of the above, with and without 'Select', using 'When'/'Then', etc, I've looked at examples, but everything seems to be within a context of returning a column--not controling logic flow.
How can I control logic like the above, without nesting If/Else's?
Thanks,
T
Select Case @DoWhat
Case 'update'
Update tblTest Set kang = 'testing';
case 'delete'
Delete from tblTest Where kang = 'testing';
case 'insert'
Insert into tblTest (kang) Values('hello');
case Else
--do something else
End Select
I've tried all manner of the above, with and without 'Select', using 'When'/'Then', etc, I've looked at examples, but everything seems to be within a context of returning a column--not controling logic flow.
How can I control logic like the above, without nesting If/Else's?
Thanks,
T