Search this blog

Wednesday, January 20, 2010

SQL SCHEMABINDING Error - Names must be in two-part format and an object cannot reference itself


Problem:
Today I Tried to Create a View WITH SCHEMABINDING then i received the following error.

Msg 4512, Level 16, State 3, Procedure VIEW_CLIENT_GLOBAL, Line 4
Cannot schema bind view 'VIEW_CLIENT_GLOBAL' because name 'FACT_CLIENT_GLOBAL' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.
I used the following Query:


Solution:
I think, you aware the use of "WITH SCHEMABINDING". If Not, Please Check My Post Here

By Error message Itself we can find out what is wrong.

When You Create a view "WITH SCHEMABINDING", Database will keep the reference with object name. many database object can be created with same name from difference user, if we create the view by using only name. There are lot of difficulties to handle. To avoid that, SQL Server expects the Object Name in Proper Format like
Owner.Object_Name.

In My Query I changed to DBO.FACT_CLIENT_GLOBAL, then i tried to create the view then it works fine.

Note: Also You have to Ensure that your Table and View should be exists in the Same Database, if you are Enabling "WITH SCHEMABINDING". Otherwise you may get the same error message

Hope it Helps you!

12 comments:

  1. This definitely helped me. Thanks very much. Love the diagram, it just explained everything in a fractional second :)

    ReplyDelete
  2. In the FROM clause, should you use dbo.FACT_CLIENT_GLOBAL

    ReplyDelete
  3. Thanks, I've solved same problem with your solution.

    ReplyDelete
  4. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Regards,
    Python Training in Chennai


    ReplyDelete
  5. Hey thanks for posting such an informative blog. Please share more frequently so that people looking to gain more knowledge can actually gain some. Keep up the
    good work.
    Php training in Chennai||Php course in Chennai

    ReplyDelete
  6. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging… Regards,
    SAS Training in Chennai

    ReplyDelete
  7. Quite Interesting post!!! Thanks for posting such a useful post. I wish to read your upcoming post to enhance my skill set, keep blogging.
    Regards,
    Python Training in Chennai|Python Training|Python Training Institutes in Chennai

    ReplyDelete
  8. Hi, actually I'am new to angularJs and infact I'am learning angularjs with online training. I'am having doubt, if you could solve the doubt for me that would be very helpful. The doubt is, how can I reset a “$timeout”, and disable a “$watch()”?
    Regards,
    angularjs training in Chennai|angularjs course in Chennai|angularjs training institute in Chennai

    ReplyDelete