1
我有以下SQL存儲過程SQL CASE語句值
@Text varchar(max),
@isArchived varchar(10)
SELECT *
FROM [Table1]
WHERE [StringText] = @ AND [isArchived] =
(CASE
WHEN @isArchived = 'ALL' THEN ???
WHEN @isArchived = 'Yes' THEN 1
WHEN @isArchived = 'No' THEN 0
END)
我的問題是的isArchived是位類型的表中,並在網頁上我有對的isArchived三個值一個下拉列表:ALL,是的,
號爲Yes
爲1(真),爲No
爲0(假),但不知道要放什麼東西在這條線:WHEN @isArchived = 'ALL' THEN ???
理想,將完全忽略該行AND [isArchived] = @isArchived
但不確定它的語法是什麼。
感謝。這樣做:)我認爲它應該沒問題,它將被放置在SSRS報告中。 –