For Example, I have 2 tables.
Table A has Setting/isActive
Table B has Name/Ages/City
So I want to retrieve records from B only when isActive = 1 for Setting ='GetThis' in Table A
something like
if 'GetThis' = 1 from table A
then get records from table B
I ended up doing this
CREATE PROCEDURE GetAllRecords
@isActive BIT
SET @isActive = (Select isActive FROM TableA WHERE Setting = 'GetThis')
AS
IF @isActive = 1
BEGIN
SELECT * FROM TableB
END
GO;