i want to ask about error handling..i have the statement insert in the spIF @StatementType ='Insert' BEGIN -- DECLARE -- @vCount int SET NOCOUNT ON; --SET @exists='DATA SUDAH ADA'; --SELECT @vCount=COUNT(*) FROM Departemen WHERE idDepartemen=@idDepartemen --IF @vCount=0 IF EXISTS (SELECT * FROM Departemen) BEGIN --for error handling with parameter END ELSE BEGIN INSERT INTO [dbo].[Departemen](nmDepartemen) VALUES (UPPER(@nmDepartemen)) END --ELSE -- RAISERROR('DATA SUDAH ADA',5,1) --SELECT nmDepartemen FROM Departemen END
i want to insert data but if the data is exists so the sp send the error to my program with parameter..or if have the best other way for the code plz tell me..anyone can help me..