Check if a parameter is null or empty in a stored procedure

前端 未结 12 1052
轮回少年
轮回少年 2020-12-02 22:09

I know how to check if a parameter is null but i am not sure how to check if its empty ... I have these parameters and I want to check the previous parameters are empty or n

12条回答
  •  北海茫月
    2020-12-02 22:38

    Here is the general pattern:

    IF(@PreviousStartDate IS NULL OR @PreviousStartDate = '')
    

    '' is an empty string in SQL Server.

提交回复
热议问题