|
USE [SampleOrderDatabase]
GO
/****** Object: StoredProcedure [proc_AnOrderLoadByPrimaryKey] Script Date: 1/16/2007 2:04:17 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[proc_AnOrderLoadByPrimaryKey]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [proc_AnOrderLoadByPrimaryKey];
GO
CREATE PROCEDURE [proc_AnOrderLoadByPrimaryKey]
(
@OrderID int
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @Err int
SELECT
[OrderID],
[CustomerID]
FROM [AnOrder]
WHERE
([OrderID] = @OrderID)
SET @Err = @@Error
RETURN @Err
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: proc_AnOrderLoadByPrimaryKey Succeeded'
ELSE PRINT 'Procedure Creation: proc_AnOrderLoadByPrimaryKey Error on Creation'
GO
/****** Object: StoredProcedure [proc_AnOrderLoadAll] Script Date: 1/16/2007 2:04:17 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[proc_AnOrderLoadAll]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [proc_AnOrderLoadAll];
GO
CREATE PROCEDURE [proc_AnOrderLoadAll]
AS
BEGIN
SET NOCOUNT ON
DECLARE @Err int
SELECT
[OrderID],
[CustomerID]
FROM [AnOrder]
SET @Err = @@Error
RETURN @Err
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: proc_AnOrderLoadAll Succeeded'
ELSE PRINT 'Procedure Creation: proc_AnOrderLoadAll Error on Creation'
GO
/****** Object: StoredProcedure [proc_AnOrderUpdate] Script Date: 1/16/2007 2:04:17 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[proc_AnOrderUpdate]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [proc_AnOrderUpdate];
GO
CREATE PROCEDURE [proc_AnOrderUpdate]
(
@OrderID int,
@CustomerID int
)
AS
BEGIN
SET NOCOUNT OFF
DECLARE @Err int
UPDATE [AnOrder]
SET
[CustomerID] = @CustomerID
WHERE
[OrderID] = @OrderID
SET @Err = @@Error
RETURN @Err
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: proc_AnOrderUpdate Succeeded'
ELSE PRINT 'Procedure Creation: proc_AnOrderUpdate Error on Creation'
GO
/****** Object: StoredProcedure [proc_AnOrderInsert] Script Date: 1/16/2007 2:04:17 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[proc_AnOrderInsert]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [proc_AnOrderInsert];
GO
CREATE PROCEDURE [proc_AnOrderInsert]
(
@OrderID int = NULL output,
@CustomerID int
)
AS
BEGIN
SET NOCOUNT OFF
DECLARE @Err int
INSERT
INTO [AnOrder]
(
[CustomerID]
)
VALUES
(
@CustomerID
)
SET @Err = @@Error
SELECT @OrderID = SCOPE_IDENTITY()
RETURN @Err
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: proc_AnOrderInsert Succeeded'
ELSE PRINT 'Procedure Creation: proc_AnOrderInsert Error on Creation'
GO
/****** Object: StoredProcedure [proc_AnOrderDelete] Script Date: 1/16/2007 2:04:17 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[proc_AnOrderDelete]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [proc_AnOrderDelete];
GO
CREATE PROCEDURE [proc_AnOrderDelete]
(
@OrderID int
)
AS
BEGIN
SET NOCOUNT OFF
DECLARE @Err int
DELETE
FROM [AnOrder]
WHERE
[OrderID] = @OrderID
SET @Err = @@Error
RETURN @Err
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: proc_AnOrderDelete Succeeded'
ELSE PRINT 'Procedure Creation: proc_AnOrderDelete Error on Creation'
GO
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I have been involved in professional software development for over 15 years, focusing on distributed applications on both Microsoft and Java platforms.
I also like long walks on the beach and a sense of humor and don't like mean people