IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'USP_BookTypes')
DROP PROCEDURE USP_BookTypes
GO
CREATE PROC USP_BookTypes
(
@action varchar(20)
,@BookTypeId int=null
,@BookType varchar(100)=null
)
AS BEGIN
IF(@action='SELECTALL')
BEGIN
SELECT B.BookTypeId,B.BookType FROM BookTypes B WITH(NOLOCK)
WHERE B.IsActive='Y' order by B.BookTypeId;
END
ELSE IF(@action='SELECTBYID')
BEGIN
SELECT B.BookTypeId,B.BookType FROM BookTypes B WITH(NOLOCK)
WHERE B.BookTypeId=@BookTypeId and B.IsActive='Y' order by B.BookTypeId;
END
END
No comments:
Post a Comment