开发者

How to set default value for a variable in a parameter list

开发者 https://www.devze.com 2023-04-10 17:15 出处:网络
I want the variable to take a default value when a value not passed to开发者_如何学Python a Table valued function.

I want the variable to take a default value when a value not passed to开发者_如何学Python a Table valued function.

Could any one please help me do this.


A table valued function with default value for a parameter.

create function GetValue(@Value int = 1) 
returns table as return 
(
  select @Value as ID
)

Use it like this

select *
from dbo.GetValue(default)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号