syntax for update stored procedure in sql server

In this article, I will how to create a store procedure for insert a value in store procedure. Stored Procedure in SQL Server can be defined as the set of logical group of SQL statements which are grouped to perform a specific task. There are many benefits of using a stored procedure. The main benefit of using a stored procedure is that it increases the performance of the database.



For More : Syntax for update stored procedure in SQLServer , Stored Procedure in SQL SERVER , Difference between Function and Stored Procedure 



First step :- creating table

Syntax for creating table:-

CREATE
TABLE [dbo].[ personalinformation](
          [UserId] [int] IDENTITY(1,1) NOT NULL,
          [Username] [nvarchar](max) NOT NULL,
          [firstname] [nvarchar](max) NULL,
          [lastname] [nvarchar](max) NULL,
          [gender] [nvarchar](max) NULL,
          [dob] [nvarchar](max) NULL,
          [email] [nvarchar](max) NULL,
          [password] [nvarchar](max) NULL,
          [nationality] [nvarchar](max) NULL,
         
 CONSTRAINT [PK_registration] PRIMARY KEY CLUSTERED
(
          [UserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


Second Step:- update stored procedure

Syntax for updating stored  procedure

CREATE
PROCEDURE [dbo].[update_userdetails]
          @username nvarchar(max),
          @firstname nvarchar(max),
          @lastname nvarchar(max),
          @gender nvarchar(max),
          @dob nvarchar(max),
          @email nvarchar(max),
          @nationality nvarchar(max),
         
         
AS
BEGIN
         
  update [personalinformation] set
          [firstname]=@firstname,
          [lastname]=@lastname,
          [gender]=@gender,
          [dob]=@dob,
          [email]=@email,
          [nationality]=@nationality,    
where
           [Username]=@username
           
           end

GO



syntax for update stored procedure in sql server syntax for update stored procedure in sql server Reviewed by NEERAJ SRIVASTAVA on 2:02:00 PM Rating: 5

No comments:

Powered by Blogger.