Avatar of BlakeMcKenna
BlakeMcKenna
Flag for United States of America

asked on 

Formatting a SQL Statement in SQL Server?

Based on the SQL Code below, how can I construct this statement?

ALTER PROCEDURE [dbo].[spLoadEquipmentCalibrationGrid]
	@equipmentType_ID		INT=NULL,
	@calibration_ID			INT=NULL
AS
BEGIN
	SET NOCOUNT ON;
	
	DECLARE @strCalibration_IDs		VARCHAR(50)
	
	IF @calibration_ID = 4
		SET @strCalibration_IDs = '(2,3,4)'
	ELSE
		SET @strCalibration_IDs = '(' + @calibration_ID + ')'
		
	IF @equipmentType_ID = 0
		SELECT	equipment_ID AS 'Equipment ID'
		  FROM  HEADER_Equipment 
		 WHERE	A.equipmentType_ID > 0 AND calibration_ID IN @calibration_ID
	  ORDER BY	B.equipmentType

Open in new window

Microsoft SQL Server

Avatar of undefined
Last Comment
BlakeMcKenna

8/22/2022 - Mon