Cannot fake function created using WITH SCHEMABINDING

Most of our functions include WITH SCHEMABINDING which causes tests that attempt to fake them to fail with the message ' cannot be renamed because the object participates in enforced dependencies'.
Do you know of any way around this?

Tagged:

Answers

  • Eddie DEddie D Posts: 1,681 Rose Gold 5
    edited January 2, 2020 4:31PM
    Hi, thank you for your forum post.

    To be honest, I do not great answer to your question.  You may need to post your question on the tSQLt web site - https://tsqlt.org  or the tsqlt user group - https://tsqlt.org/join-the-conversation/ .

    The actual steps are Stored Procedures that you can copy and edit, which then can be run as a test that you have created.

    I suspect the only workaround to your problem, is to edit the Stored Procedure that tests the function or functions, remove the schema binding before the running the test that fakes the function.  When the test completes add back the schema binding to the function.   

    However, I have not tested the above, so please try against a test or development database before implementing any changes.

    Many Thanks
    Eddie
    Eddie Davis
    Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
Sign In or Register to comment.