How do you create a stored procedure?



/****** Object:  StoredProcedure [dbo].[Procedure_Syntax]    Script Date: 05/01/2018 12:23:08 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author: <Manoj Kumar,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[Procedure_Syntax]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON; 
-- Insert statements for procedure here
BEGIN TRY
--BEGIN TRAN
SELECT 1
--COMMIT
END TRY

BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK

INSERT INTO ErrorLogDetail (
[Error_Number]
,[Error_Message]
,[Error_Severity]
,[Error_State]
,[Error_Line]
,[Error_Procedure]
,[UserName]
,[HostName]
)
VALUES (
ERROR_NUMBER()
,ERROR_MESSAGE()
,ERROR_SEVERITY()
,ERROR_STATE()
,ERROR_LINE()
,OBJECT_NAME(@@PROCID)
,CURRENT_USER
,HOST_NAME()
)
END CATCH
END


Comments

Popular posts from this blog

How to Set Default Controller in asp.net MVC 4 & MVC 5 ?

Independency in Object Oriented Programming(OOP’S) languages

Operating System (OS) OR Platform Independency