Thursday, February 4, 2010

HOW TO WRITE PROCEDURE FOR INSERT

set ANSI_NULLS ON
set QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[360LMS_User_Registration]
(
@college_name nvarchar(50),
@user_name nvarchar(50),
@password nvarchar(50),
@rollnumber nvarchar(10),
@first_name nvarchar(50),
@middle_name nvarchar(50),
@last_name nvarchar(50),
@sex char(1),
@birth_date datetime,
@faculty nvarchar(50),
@qualification nvarchar(50),
@mobile_number nvarchar(15),
@email_id nvarchar(50),
@address nvarchar(50)
)

AS

INSERT INTO

[360LMS_Users](CollegeName,UserName,Password,RollNumber,FirstName,MiddleName,LastName,Sex,BirthDate,Faculty,Qualification,Mob

ileNumber,EmailID,Address,RegistrationDate)

VALUES(@college_name,@user_name,@password,@rollnumber,@first_name,@middle_name,@last_name,@sex,@birth_date,@faculty,@qualific

ation,@mobile_number,@email_id,@address,getdate())


FOR UPDATE

update [360LMS_Users] set

FirstName=@first_name,MiddleName=@middle_name,LastName=@last_name,CollegeName=@college_name,Sex=@sex,BirthDate=@birth_date,Fa

culty=@faculty,Qualification=@qualification,MobileNumber=@mobile_number,EmailID=@email_id,Address=@address where

UserID=@user_id

No comments:

Post a Comment