MSSQL的存储过程怎么写?
发布网友
发布时间:2022-04-27 09:49
我来回答
共1个回答
热心网友
时间:2022-04-08 11:21
-- =============================================
-- Create procere basic template
-- =============================================
-- creating the store procere
IF EXISTS (SELECT name
FROM sysobjects
WHERE name = N'<procere_name, sysname, proc_test>'
AND type = 'P')
DROP PROCEDURE <procere_name, sysname, proc_test>
GO
CREATE PROCEDURE <procere_name, sysname, proc_test>
<@param1, sysname, @p1> <datatype_for_param1, , int> = <default_value_for_param1, , 0>,
<@param2, sysname, @p2> <datatype_for_param2, , int> = <default_value_for_param2, , 0>
AS
SELECT @p1, @p2
GO
-- =============================================
-- example to execute the store procere
-- =============================================
EXECUTE <procere_name, sysname, proc_test> <value_for_param1, , 1>, <value_for_param2, , 2>
GO