A View problem 2

  • Hi,

    I use sp_refreshview to refresh my view when I change the structure of my table. It works when I add a column to my table but if I remove a column and run sp_refreshview on my view, the following error occur :

    Server: Msg 4502, Level 16, State 1, Procedure vwRR, Line 5

    View 'vwRR' has more column names specified than columns defined.

    Server: Msg 4413, Level 16, State 1, Line 5

    Could not use view 'vwRR' because of previous binding errors.

    Is there any other stored procedure I should use for this ?

    Thank you,

    DaSaint

    security@army.net

  • Did you try running the alter view statement first?

    Andy

  • I don't want to alter my view because it is very big and I need to run all my SQL script at my customer office so I want my SQL scripts to be short as possible.

    Do you have any others ideas ?

    Thanks,

    DaSaint

    security@army.net

  • The error sounds like you still have an item in it that no longer exists in the table. Are you saying you want something that will remove for you? If so I can easily cook something up I am sure.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Yes I remove a column from my table. Since sp_refreshview is working when I Add a column I wonder why there is nothing to refresh a view when I remove a column froma table. Don't cook nothing, I just want to know if there is something that exist to refresh my view when I remove rows from my tables ?

    Thanks

  • ANswer is no, I cannot find anything to do this. Also sp_RefreshView is actually an extended stored procedure so I cannot see if there is anything you could add to it to do.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Are you doing select * or explicitly naming all the tables? How big can the script possibly be?

    Andy

  • This view link 15 tables. It is BIG. All the table are named explicitly but one of them is like "Table.*" because its the principal table of this view.

    Any ideas or solution to refresh the view when I remove a field from the table from who I "select *" ???

    Thanks

  • Sorry, I guess Im still not clear - does it matter how big it is? That's the whole point of sp_refreshview, you can run the alter and when it's done do the refresh. How long does it take to create the view when you run it?

    Andy

Viewing 9 posts - 1 through 9 (of 9 total)

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