DECLARE @Flag int ,
@Count1 int ,
@Count2 int ,
@Count3 int ,
@Count4 int ,
@ShippingLineID int
select @Count1 = COUNT(ContainerID) from tbl_CMS_Container where ShippingLine = @ShippingLineID
select @Count2 = COUNT(EmptyContainerID) from tbl_CMS_Empty_Container where ShippingLine = @ShippingLineID
select @Count3 = COUNT(ExportContainerID) from tbl_CMS_Export where ShippingLine = @ShippingLineID
select @Count4 = COUNT(GatePassId) from tbl_CMS_GatePass where ShippingLine = @ShippingLineID
if @Count1 = 0 and @Count2 = 0 and @Count3 = 0 and @Count4 = 0
BEGIN
SET @Flag = 0
END
else
begin
SET @Flag = 1
end
SELECT @Flag