Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello,I am verifying various inputs of an SQL procedure.When an input is invalid according to a certain condition I want to give it a numeric value to an OUTPUT parameter, return it and stop from running the remaining procedure code.I was using IF but now I started using CASE:SELECT CASE @FEEDBACK WHEN NOT EXISTS (SELECT * FROM dbo.Documents WHERE DocumentId = @DocumentId) THEN -1 WHEN NOT EXISTS (SELECT * FROM dbo.Users WHERE UserId = @UserId) THEN -2ENDThis is not working. And do I need to place a RETURN @Feedback inside each WHEN?And finally, is this the way to do this?Thanks,Miguel
spirit1
Cybernetic Yak Master
11752 Posts
Posted - 2007-02-12 : 10:56:18
no.you have to use if.Go with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp