IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestSetupsGet]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[sp_TestSetupsGet] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TestSetupsGet]') AND type in (N'P', N'PC')) BEGIN EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_TestSetupsGet] AS' END GO ALTER PROCEDURE [dbo].[sp_TestSetupsGet] @TestSetupId int = null, @TestSetupName nvarchar(50) = null AS BEGIN SET NOCOUNT ON; if(@TestSetupName is not null) begin set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName) end SELECT [TestSetupName] as 'SetupName' ,[SetupDescription] ,[AutomaticTestProgression] ,[AutomaticProgressionDelayMS] ,[InvertTrigger] ,[InvertStart] ,[ViewDiagnostics] ,[VerifyChannels] ,[AutoVerifyChannels] ,[VerifyChannelsDelayMS] ,[RecordingMode] ,[SamplesPerSecond] ,[PreTriggerSeconds] ,[PostTriggerSeconds] ,[StrictDiagnostics] ,[RequireConfirmationOnErrors] ,[ROIDownload] ,[ViewROIDownload] ,[DownloadAll] ,[ViewRealtime] ,[RealtimePlotCount] ,[ROIStart] ,[ROIEnd] ,[ViewDownloadAll] ,[Export] ,[ExportFormat] ,[LabDetails] ,[UseLabDetails] ,[CustomerDetails] ,[UseCustomerDetails] ,[AllowMissingSensors] ,[AllowSensorIdToBlankChannel] ,[LocalOnly] ,[LastModified] ,[LastModifiedBy] ,[TurnOffExcitation] ,[TriggerCheckRealtime] ,[TriggerCheckStep] ,[PostTestDiagnostics] ,[ExportFolder] ,[DownloadFolder] ,[CommonStatusLine] ,[SameAsDownloadFolder] ,[UploadData] ,[UploadDataFolder] ,[Settings] ,[WarnOnBatteryFail] ,[Dirty] ,[Complete] ,[ErrorMessage] ,[TestEngineerDetails] ,[UseTestEngineerDetails] ,[UserTags] ,isnull([DoAutoArm], 0) as [DoAutoArm] ,isnull([CheckoutMode], 0) as [CheckoutMode] ,isnull([ISFFile], 0) as [ISFFile] ,isnull([QuitTestWithoutWarning], 0) as [QuitTestWithoutWarning] ,isnull([NotAllChannelsRealTime], 0) as [NotAllChannelsRealTime] ,isnull([NotAllChannelsViewer], 0) as [NotAllChannelsViewer] ,isnull([SuppressMissingSensorsWarning], 0) as [SuppressMissingSensorsWarning] from [dbo].[TestSetups] where ((@TestSetupId is null or @TestSetupId= 0) or TestSetupId = @TestSetupId) and (@TestSetupName is null or TestSetupName = @TestSetupName) END GO