ALTER PROCEDURE spServiceFormGet (@.TicketNo int, @.Name char(50))
ASIF NOT EXISTS (SELECT SolutionID FROM ServiceForm where SolutionID = @.TicketNo)
RETURN -100IF EXISTS (SELECT SolutionID, SolvedBy FROM ServiceForm
WHERE SolutionID = @.TicketNo AND SolvedBy LIKE @.Name
OR SolutionID = @.TicketNo AND SolvedBy IS NULL)
SELECT * FROM serviceform where SolutionID=@.TicketNo
RETURN 200ELSE <-- something like that
RETURN -101 <-- something like that
Thanks,
-Gabian-Gabian,
Do a google search on MSSQL Output Variables.
You should return a @.outputStatus variable here.
ScAndal|||I am not sure I understand what a return code is buying you in this case - Is there more to the proc than you are posting?
If there is no solutionid matching the ticket (first test) than you know there will be no solutionid matching a ticket AND a name...
Why not just execute the select with the (ticketid, name) filter and interogate the result set for records. If the count = 0 - you know there are no solutionid's matching this ticketno and/or name ??|||Thanks for answering guys, I've got it!
-Gabian-sql
没有评论:
发表评论