Run ALTER on a PROCEDURE that is referenced by another object

Asked

Viewed 32 times

1

I’m trying to change/drop the function [xxxx] according to the code.

But the following error returns to me

Msg 3729, Level 16, State 3, Procedure xxxxx, Line 1 [Batch Start Line 15] 
Cannot ALTER 'dbo.xxxxx' because it is being referenced by object 'bbbbb'

By my searches I saw that there is no way to perform a DDL command for scalar functions with the clause 'SCHEMABINDING', another point is that the table in which the SELECT of Function query there is a Constraint.

ALTER FUNCTION [dbo].[xxxxx]
(
    -- Add the parameters for the function here
    @Cliente as nvarchar(100) 
)
RETURNS bigint
WITH SCHEMABINDING
AS
BEGIN

    RETURN (0)

END
GO

OBS: Yes, I want her to return 0.

I would like to know if it is possible to carry out this DROP/ALTER

  • The SCHEMABINDING doesn’t just look at the CONSTRAINTS of the tables you refer to, but also to the types, that is, using this the function is referenced to the table to prevent it from changing. You really need to use that?

  • Who is or what is 'bbbbb'?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.