sql server 2008 - sp_refreshview throws unexpected error -


I am currently writing a TSQL script where the part of the script refreshes all the views of the database. After finding the example online I am repetitive through the collection, but a strange issue when one of the scenes (not earlier) getting refreshed

When running the query below, I get a result from the sysobjects table

  select * from sysobjects where type = 'V' and name = 'vwEnginesFinishBuiltToday'  < / Pre> 

Enter image details here

Then one of the exceptions to running refresh Returns

  exec sp_refreshview N'dbo.vwEnginesFinishBuiltToday '  

 Enter image description here

Now the thing is the error that I'm saying a scene with a different name that can not be found The issuer. Its true that it is not present in the database, so that another view was done using thinking dbo.vwEnginesFinishBuiltToday internally I see the TSQL view.

  Select COUNT (dbo.tblBatches.IdBatch) TotalEnginesFinishedToday as dbo.tblBatches from within include on dbo.tblBatches.IdBatch = dbo.tblEngines.idBatch dbo.tblEngines ( YEAR (dbo.tblEngines.DateFinished) = year (GETDATE ()) and (MONTH (dbo.tblEngines.DateFinished) = month (GETDATE ()) and (DAY (dbo.tblEngines.DateFinished) = (Day GETDATE () ))   

Mmmmm, no mention of dbo.vwEnginesFinishedDay not see there, I am struggling to find out the problem.

Is there a problem with the sp_refreshsqlmodule_internal method in SQL Server or is there anything clear to me?

It seems that you have changed the name of the scene at some point in the past, either using Taxes or SSMS Object Explorer When you try to refresh the view, trying to change the view using the sp_refreshview original view name, which no longer exists.

Try to use as a script view - & gt; Optional for - & gt; To generate the ALTER VIEW script, execute the new query editor window, option

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -