Conditional Operator in SQL Where Clause

前端 未结 5 2056
我寻月下人不归
我寻月下人不归 2020-12-20 16:47

I\'m wishing I could do something like the following in SQl Server 2005 (which I know isnt valid) for my where clause. Sometimes @teamID (passed into a stored procedure) wi

5条回答
  •  猫巷女王i
    2020-12-20 17:23

    What about:

    Select Team.teamID From Team Where (@teamid=0 and team.teamID>0) or (@teamid<>0 and team.teamid=@teamid)
    

提交回复
热议问题