@ symbol is manadatory with every input and output parameter
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE Getstudentname
-- Add the parameters for the stored procedure here
@studentid INT
AS
BEGIN TRY
BEGIN TRANSACTION -- Start the transaction
SELECT Firstname+' '+Lastname FROM tbl_Students WHERE studentid=@studentid
-- If we reach here, success!
COMMIT
END TRY
BEGIN CATCH
-- there was an error
IF @@TRANCOUNT > 0
ROLLBACK
-- Raise an error with the details of the exception
DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int
SELECT @ErrMsg = ERROR_MESSAGE(), @ErrSeverity = ERROR_SEVERITY()
RAISERROR(@ErrMsg, @ErrSeverity, 1)
END CATCH
GO
Shanky11, if this helps please login to Mark As Answer. | Alert Moderator