sql - Not taking into account condition -
Suppose i have a parameter @ user id, this can be 0 (no user specified) or own id The structure of the query is as follows:
If @UserID & gt; Select 0 ... where UserID = @ UserID ... else if select @userid = 0 ... ou ... What do I need to do the following structure Select ... where the user id & gt; 0 then userID = @ USIDID and ignore this condition ... thanks
Set as parameter value instead of 0 (zero)
Announce @id int set @id = null * From users (id = @ Id) or (@IID is empty)
Comments
Post a Comment