schema bind view

  • We need to change a view that is using schema binding. In the view we used a UDF.

    But when alter it, it complains that the function is not schema bind, we have to schema bind the function , then the view will work.

    But the UDF actullly is for a Split comma delimted strings, not actually bound to any tables.

    So should we schema bind the function so that the View can be altered,

    And we have two other sproc using the function, could they be affected if we change the function to schema binded?

    any other recommendations,

  • sqlfriends (4/12/2013)


    We need to change a view that is using schema binding. In the view we used a UDF.

    But when alter it, it complains that the function is not schema bind, we have to schema bind the function , then the view will work.

    But the UDF actullly is for a Split comma delimted strings, not actually bound to any tables.

    So should we schema bind the function so that the View can be altered,

    And we have two other sproc using the function, could they be affected if we change the function to schema binded?

    any other recommendations,

    If you look at Jeff's DelimitedSplit8K function you will see that it is schema bound (created with schemabinding). I'd say do it. It should not affect the other code. If in doubt, do it in a test environment first and see.

  • Does the view have to be schema bound?

    Where I used to work there was a common misconception that a schema bound view was the same as an indexed view. People would schema bind the views, but then not create any indexes.

  • Ed B (4/12/2013)


    Does the view have to be schema bound?

    Where I used to work there was a common misconception that a schema bound view was the same as an indexed view. People would schema bind the views, but then not create any indexes.

    Schema binding a view does offer other "advantages". Underlying tables/columns can't be modified or dropped if they affect the view. If indexes aren't created, there may be other reasons they do it.

  • It is not using index for the view.

    It is developed by other developers that has gone.

    It does have underlying tables for the view, so I guess one purpose for using schema binding is prevent the view broken if table structure changed.

    Using it, if table structure change it, it will remind you to change the view too. Thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply