CREATE PROCEDURE sp_insertemployee
@FirstName nvarchar(10),
@LastName nvarchar(20),
@Title nvarchar(30),
@Notes nvarchar(200),
@PK_New int OUTPUT
AS
INSERT INTO Employees(FirstName,LastName,Title,Notes)
VALUES (@FirstName,@LastName,@Title,@Notes)
SELECT @PK_New = @@IDENTITY
RETURN (1)
GO
---------------------------------------------------------------
IF ( OBJECT_ID('dbo.sp_Students_INS_byPK') IS NOT NULL )
DROP PROCEDURE dbo.sp_Students_INS_byPK
GO
CREATE PROCEDURE dbo.sp_Students_INS_byPK
@student_id INT ,
@password VARCHAR(15) = NULL ,
@active_flg TINYINT ,
@lastname VARCHAR(30) = NULL ,
@birth_dttm DATETIME = NULL ,
@gpa INT = NULL ,
@is_on_staff TINYINT
AS
BEGIN
SET NOCOUNT ON
INSERT INTO dbo.Students
(
student_id ,
password ,
active_flg ,
lastname ,
birth_dttm ,
gpa ,
is_on_staff
)
VALUES
(
@student_id ,
@password ,
@active_flg ,
@lastname ,
@birth_dttm ,
@gpa ,
@is_on_staff
)
END
GO
----------------------------------------------------------------------
EXECUTE [dbo].[spINSERT_dbo_Customer]
@FirstName = 'Tommy'
,@LastName = 'Crabber'
,@PhoneNumber = '333-333-3333'
,@EmailAddress = 'tommy@KingCrabber.com'
,@Priority = 1
,@CreateDate = '2011-09-15'
GO
No comments:
Post a Comment