USE [library]
GO
/****** Object: StoredProcedure [dbo].[insertNewBook] Script Date: 12/25/2010 22:04:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date:
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[insertNewBook]
(
@bookID BIGINT,
@bookTitle VARCHAR(100),
@bookAuthor VARCHAR(100),
@bookImage IMAGE
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@bookID=0)
begin
insert into books (bookTitle,bookAuthor,bookImage)
values
(@bookTitle,@bookAuthor ,@bookImage)
end
else
begin
update books set bookTitle=@bookTitle,
bookAuthor=@bookAuthor,
bookImage=@bookImage
where bookID=@bookID
end
END
No comments:
Post a Comment