|
Hi, We have a database that keeps track of lots and lots of objects. We have three views, all of which have "Object" in their name (these three are the only objects in our DB that have "Object" in their name). I created an update script through VS 2010 and get the following errors: Now, notice how the word "Object" is not in the error when it complains about the view name and is when it tells us what the view name is. Those were the only three errors. When I looked at sp_refreshsqlmodule, I notices that "OBJECT" is the value of one of its internal variables, but I couldn't track down how else it is used. At this point, it would be quite difficult to change the names of these objects. Is this a strange coincidence, something that everyone else knows about that I should have or something that can be easily worked around? Thanks, Rob
(comments are locked)
|
|
Hi, It looks like you were right. It looks like SQL Server didn't properly change its internal tables when the view name was changed. In the database itself, there are a few references to the same object_id (referring to the view):
Hmm, can I assume that SQL Server does not know how to properly rename an object in that it only changes the name but does not change the "CERATE" that it stores for when it might need to re-create the table? Or, is the lesson that I should never trust that CREATE? (I assume that when I right-click on an object and ask it to "script a CREATE to a new window", it copies this string to the window...) Thanks... Rob Renaming an object doesn't change it's stored creation DDL. When you script it, the client has to detect old names and correct them. That's certainly what I had to do in the IDE that I wrote...
May 03 '11 at 08:02 AM
Matt Whitfield ♦♦
(comments are locked)
|
|
OK... This script was generated by Visual Studio 2010. Thanks.
(comments are locked)
|
|
Can you post the script that was generated, as well as the error message? Because the 'refreshing' bit is generated by 'PRINT' statements in the script. So it may well be an error in the generation of the script, and not with the system proc. Have you tried running Edit -> OK, after looking at your comment, I believe what has happened is that the object was originally called Your best bet is to script out the object as an @Matt Whitfield Very good answer! The lesson learned should be that sp_rename should be used with caution :)
May 03 '11 at 08:15 AM
Oleg
(comments are locked)
|

