-- =============================================
ALTER PROCEDURE [dbo].[NST_GetCboCurrencyAfterUpdate]
@AccCurrency nvarchar(3)='',
@AccSgroup nvarchar(6)= '',
@AccInternalCie int=null
AS
BEGIN
SET NOCOUNT ON;
IF @AccInternalCie is not null and @AccCurrency <> '' and @AccSgroup <> ''
Begin
SELECT * FROM TblAccounts Where
AccInternalCie = @AccInternalCie and AccCurrency = @AccCurrency and AccSgroup = @AccSgroup ORDER BY AccDescription
End
Else if @AccInternalCie is not null and @AccCurrency <> ''
Begin
SELECT * FROM TblAccounts Where
AccInternalCie = @AccInternalCie and AccCurrency = @AccCurrency ORDER BY AccDescription
END
Else if @AccInternalCie is not null and @AccSgroup <> ''
Begin
SELECT * FROM TblAccounts Where
AccInternalCie = @AccInternalCie and AccSgroup = @AccSgroup ORDER BY AccDescription
END
Else if @AccCurrency <> '' and @AccSgroup <> ''
Begin
SELECT * FROM TblAccounts Where
AccCurrency = @AccCurrency and AccSgroup = @AccSgroup ORDER BY AccDescription
END
Else if @AccSgroup <> ''
Begin
SELECT * FROM TblAccounts Where
AccSgroup = @AccSgroup
Print @AccSgroup
END
Else if @AccCurrency <> ''
Begin
SELECT * FROM TblAccounts Where
AccCurrency = @AccCurrency ORDER BY AccDescription
END
Else if @AccInternalCie is not null
Begin
SELECT * FROM TblAccounts Where
AccInternalCie = @AccInternalCie
END
end
次のストアドプロシージャがあります。SQLSERVERMANAGEMENTSTUDIOでデバッグをテストするにはどうすればよいですか。特定のクエリがどのように実行されているか。
Select * from TblAccounts where AccSGroup = '1000'
AccSGroupだけが''と等しくないと言うので
Else if @AccSgroup <> ''
Begin
SELECT * FROM TblAccounts
Where AccSgroup = @AccSgroup
Print @AccSgroup
END
クエリを実行し、残りをバイパスする必要があります