Hi, I am a new in stored procedure and I now do the following function:

ALTER PROCEDURE dbo.ViewFaultyTbl
	@id int
		
AS
	 SET NOCOUNT ON;
	 DECLARE @indicator int
	 
	 SELECT @indicator=Indicator
	  FROM FautyScanTbl  
	  
	  if @indicator=0
	  BEGIN
	  
	  SELECT *
	  FROM FautyScanTbl
	  WHERE	ID=@id	  
	  
	  END	  
	  
	  ELSE
	 	 BEGIN
	 	 
	 	 
	 	 
	 	 END

Indicator is a column in my table which is integer, in my program, every time it wants do a function, it must check the indicator column (default 0). If 0, then it will do event(if), if 1, then i will skips the row and go to next record.
I don't know how to write the statement inside, can someone help me please.

Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.