1
我試圖在where語句中創建以下內容。SQL服務器如果在哪裏函數開始語句
where Registration_Date >[email protected] and Registration_Date < dateadd(day,1,@EndDate)
and if @affiliateid is null begin Channel in (select Value from dbo.Split(',',@Channel)) end
else Affiliate_Id in (select Value from dbo.Split(',', @AffiliateId))
and Registration_Channel in (select Value from dbo.Split(',', @Channel))
所以,我想說的是,如果@AffiliateId爲空,則使用@Channel輸入所有加盟的ID,如果沒有則使用特定的@AffiliateId,不論通道。
有什麼辦法可以讓這項工作?
這個工程很漂亮! – angeliki 2013-04-25 11:19:58