Solved

Refresh multiple views

Posted on 2008-10-14
3
244 Views
Last Modified: 2013-11-24
Hi, first time question here, so please be gentle.
I've detached and attached a CRM database but need to refresh the views. Can I do this in one go, or am I studk with doing each view individualy.

Many Thanks. Please don't hesistate if you need more info, which I presume you all will.

Mark
0
Comment
Question by:mark_uunix
  • 2
3 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
define "REFRESH VIEWS"

if you mean that the definition of the underlying tables, from which you had views doing "select *" then the command you want to issue is sp_refreshview and I can help you automate that.  But before we do that, do you mean that or do you want to refresh the data in views?

Because data isn't stored in views (unless it's indexed but we won't get into that).  A view is like a saved SQL statement.  It allows you to repeat large, possibly complex SQL statements as a simple select.

So if you had:
select * from Table1 t1 join table2 t2 on t1.id=t2.id

you could write this
create view vw_MyView
as
select * from Table1 t1 join table2 t2 on t1.id=t2.id
go

which would allow you to do this:

select * from vw_myView

This simplifying the SQL select statement.
0
 

Accepted Solution

by:
mark_uunix earned 0 total points
Comment Utility
Many thanks Brandon for your reply, it was EXEC sp_refreshview command that I was looking at - at first, turns out, it was permissions issue anyway.

Mark
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
How did you discover it was a permission issue and what kind of permission issue?
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now