I have this stored procedure, I was wondering if "if exists" will actually compare the value returned by select statement or it will just check if that condition can be executed or not, sorry for such a stupid question but I am new to SQL,
declare @m_ID_v int set @m_ID_v = ( select ID_C from M_T where MName_C = @MName_parameter) declare @g bit if exists (select G_L_Column from G_L_table Where M_ID_Column = @M_ID_variable) set @g_v = 1 else set @g_variable = 0 my select statement
select G_L_Column from G_L_table Where M_ID_Column = @M_ID_variable Is returning either true or false, so just wanna make sure if "if exists" will work as "if"
if existswill execute if your select query inside it return at least 1 record, equal toif((select query).records.count > 0)