且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL函数作为默认参数值?

更新时间:2022-12-15 19:22:53

存储过程参数的默认值必须是常量.您需要执行以下操作...

Default value for stored procedures parameter have to be constants. You'd need to do the following...

ALTER Procedure [dbo].[my_sp]
@currentDate datetime = null
AS
IF @currentDate is null
SET @currentDate = getdate()