USE [SchoolDB]

GO

/****** Object:  StoredProcedure [dbo].[SP_Student]    Script Date: 8/14/2020 10:44:28 AM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER PROCEDURE [dbo].[SP_Student]

@StudentId varchar(50)

,@Name varchar(MAX)

,@Roll varchar(6)

,@Photo varbinary(MAX)


AS

BEGIN TRAN

SET @StudentId = (SELECT MAX(StudentId) FROM Student) + 1


INSERT INTO Students  (StudentId, [Name], Roll, Photo)

       VALUES(@StudentId, @Name, @Roll, @Photo)


SELECT * FROM Students WHERE StudentId=@StudentId



COMMIT TRAN