Bug on Find Invalid Objects

Provides intelligent code completion for SQL Server editors.

Moderators: Anu Deshpande, Aaron Law, David Priddle

Bug on Find Invalid Objects

Postby DanAvni » Fri Aug 22, 2014 9:16 am

I have the function below on a DB. the table ObjectPermissions does not exist anymore but the function does not list as an invalid object

ALTER FUNCTION [dbo].[CheckEnforceGroupPermissionsForEmployeeGUID]
(
@EmployeeGUID uniqueidentifier,
@EnforceGroupPermissionsForUserGuid uniqueidentifier
)
RETURNS bit
AS BEGIN
DECLARE @RetVal as bit
IF @EnforceGroupPermissionsForUserGuid is null
BEGIN
SET @RetVal = 1
end
ELSE
begin --running against a specific user
declare @GroupGUID uniqueidentifier
select @GroupGUID = GroupGuid
From Employees
Where Employees.Guid = @EmployeeGUID
if @GroupGUID is null
begin --no group for employee
SET @RetVal = 0
end
else
begin --employee has a group
if exists ( Select *
From ObjectPermissions
where ObjectGuid = @GroupGUID AND
UserGuid = @EnforceGroupPermissionsForUserGuid AND
ObjectType = 0 )
begin
SET @RetVal = 1
end
else
begin
SET @RetVal = 0
end
end
end
RETURN @RetVal

END
Dan Avni
DanAvni
 
Posts: 48
Joined: Wed Jun 15, 2005 12:55 pm

Postby Aaron Law » Fri Aug 22, 2014 11:57 am

Hi Dan,

Thanks for your post, I can recreate this here and will look into seeing what we can do about fixing it.

Thanks,
Aaron.
Aaron Law
 
Posts: 262
Joined: Fri Jun 28, 2013 10:56 am
Location: Red Gate Software

Postby Aaron Law » Fri Aug 22, 2014 1:44 pm

Hi Dan,

We think we've got a fix for you, could you please give this private build a try and let us know if the function is correctly detected as invalid?

Thanks,
Aaron.
Aaron Law
 
Posts: 262
Joined: Fri Jun 28, 2013 10:56 am
Location: Red Gate Software


Return to SQL Prompt 6

Who is online

Users browsing this forum: No registered users and 0 guests