CREATE PROCEDURE ct_UserAuditListing @tiUserID int, @tcAction varchar(30) --tiUserID=0 we want all users --tcAction="ALL" we want all actions as IF @tiUserID>0 and @tcAction='ALL' select * from coAudit where UserID=@tiUserID IF @tiUserID=0 and @tcAction='ALL' select * from coAudit