本文介绍了如何在SQL Server上创建存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在那10行上有表格,所以我需要在一行上写一些逻辑
i have table on that 10 rows so i need to write some logic one row
推荐答案
USE DBNAME
GO
/****** Object: StoredProcedure [dbo].[USP_TMSAddFormat] Script Date: 04/18/2012 18:35:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Tony Tom
-- Create date: 2-Sep-2011
-- =============================================
Create PROCEDURE [dbo].[USP_TMSAddFormat]---Sps Name
@FormatType varchar(10),
@CreatedBy varchar(50),
@ErrorDescription varchar(1000) OUTPUT
AS
BEGIN
SET NOCOUNT ON
BEGIN TRY
BEGIN TRANSACTION;
INSERT INTO [Format]
([FormatType]
,[CreatedBy]
,[CreatedDate])
VALUES
(
@FormatType,
@CreatedBy,
CURRENT_TIMESTAMP
)
COMMIT TRANSACTION;
return 0
END TRY
BEGIN CATCH
Set @ErrorDescription = error_message()
ROLLBACK TRAN
End Catch;
End
这篇关于如何在SQL Server上创建存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!