0
如果我有这样一个存储过程:执行存储过程缺少不同的参数调用
CREATE Procedure [dbo].[insertIntoTableX]
-- table_name as there are three tables with the same schema...
@table_name varchar(200),
-- all the other variables for the columns
@column_1 = NULL,
@column_2 = NULL,
@column_3 = NULL,
@column_4 = NULL,
@column_5 = NULL
AS
BEGIN TRY
SET NOCOUNT ON
INSERT INTO @table_name (column_1, column_2, column_3, column_4, column_5)
VALUES (@column_1, @column_2, @column_3, @column_4, @column_5)
END TRY
BEGIN CATCH
-- ....
END CATCH
如果我Execute insertIntoTableX (1,2,3,4)
调用它,其结果将是[1
,2
,3
,4
,NULL
]因为第五个被存储过程中的默认值设置为null。
如何使用缺少的参数调用它?例如。如果想要结果是[NULL
,NULL
,3
,NULL
,5
]?