Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Sunday, February 26, 2012

does a view refresh itself when i reference it? (was "Question On Views")

guys, ive never worked with Views before so forgive me.
i know how to create one, and that it creates a virtual table in memory, but i've got one small question.

if i create a view:

CREATE view dbo.myView
as
select Distinct FirstName,LastName from SomeTable

When ever i reference that view, such as
Select FirstName,LastName
from myView
where LastName like 'Jo%'

does that View Refresh itself??

in other words does it run each time i Reference it? or is it static from when i created it.

Wouldnt it be easier just to use a #TempTable or some other Table thats used to hold a few values?

thanks for any help
rikDont worry man ,view is not static .It always fetch records from base table.It is uptodate unless u r using index on views|||You know - I've always thought that the definition of a view as something like a virtual table as very confusing. When I studied relational databases the chapter on views made an assumption that the reader would be very confused at what differentiated a view from a table and spent line after line emphasising the difference. "No " thought I "I can very well differentiate a view from a table - what the flip is the distinction between a view and a query?"

The way I tend to think of views (indexed views excluded) is that a view is best thought of as a persistent, optimised, stored query that can usually be treated in the same way that you would treat a table as far as viewing data is concerned. It is, however, just that - a view of the data. As such, it does not store any data itself. Every time you call it it views the data afresh.

HTH|||thank you guys so much. that's exactly the answer i was looking for.
thanks again
rik

Does a View of an Indexed Table has a View?

Hi,
I have a View, which is actually a Union of some joins of some Tables. All
these Tables have indexes.
Will these indexes speed up a query when doing a Select on the View? Or will
the view behave as a non-indexed table? Should I take in account a lack of
performance when using the view?
any answers, explanations, workarounds for this are welcome!
Thanks a lot in advance,
Pieter
Pieter wrote:
> Hi,
> I have a View, which is actually a Union of some joins of some
> Tables. All these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View?
> Or will the view behave as a non-indexed table? Should I take in
> account a lack of performance when using the view?
Indexes are used if appropriate for your query criteria. You can see this
by looking at the execution plan with QA.
Kind regards
robert
|||Hi Pieter
Views are virtual tables and they are not actual tables. When you try to
query a view, u will actually be executing a query.
The query will use the same indexes that a table is using.
However u can create an index on views, creating an index on a view will
effect that query only and not the main table
please let me know if u have any questions
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
"Pieter" wrote:

> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or will
> the view behave as a non-indexed table? Should I take in account a lack of
> performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>
>
|||Pieter,

> Will these indexes speed up a query when doing a Select on the View?
The answer is "it depends". i.e., what columns are you asking for? what
rows? do the index(es) match the row criteria? are the columns highly
selective? etc.. etc...
If the optimizer determines that an index(es) can assist in accessing the
data from the underlying tables when the view is queried, then the optimizer
will likely use the index(es). Use the Display Estimated Execution Plan
(Ctrl+L) to determine the predicted access method.
Creating an index on a view (clustered) will make a copy of the data. This
approach is useful when the underlying data does not change very often and
aggregates are involved.
HTH
Jerry
"Pieter" <pietercoucke@.hotmail.com> wrote in message
news:Olj4WGX2FHA.2436@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or
> will the view behave as a non-indexed table? Should I take in account a
> lack of performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>
|||Ok thanks a lot for the info!
One more question: In the enterprise Manager the option "All Tasks" ->
"Manage Indexes" is disabled when right-clicking on the View. Is the only
way to manage indexes on a View via the query analyzer?
"Chandra" <chandra@.discussions.microsoft.com> wrote in message
news:EFC3D7B8-44AE-4721-9875-9EFF46F72190@.microsoft.com...[vbcol=seagreen]
> Hi Pieter
> Views are virtual tables and they are not actual tables. When you try to
> query a view, u will actually be executing a query.
> The query will use the same indexes that a table is using.
> However u can create an index on views, creating an index on a view will
> effect that query only and not the main table
> please let me know if u have any questions
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://www.SQLResource.com/
>
> "Pieter" wrote:

Does a View of an Indexed Table has a View?

Hi,
I have a View, which is actually a Union of some joins of some Tables. All
these Tables have indexes.
Will these indexes speed up a query when doing a Select on the View? Or will
the view behave as a non-indexed table? Should I take in account a lack of
performance when using the view?
any answers, explanations, workarounds for this are welcome!
Thanks a lot in advance,
PieterPieter wrote:
> Hi,
> I have a View, which is actually a Union of some joins of some
> Tables. All these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View?
> Or will the view behave as a non-indexed table? Should I take in
> account a lack of performance when using the view?
Indexes are used if appropriate for your query criteria. You can see this
by looking at the execution plan with QA.
Kind regards
robert|||Hi Pieter
Views are virtual tables and they are not actual tables. When you try to
query a view, u will actually be executing a query.
The query will use the same indexes that a table is using.
However u can create an index on views, creating an index on a view will
effect that query only and not the main table
please let me know if u have any questions
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"Pieter" wrote:
> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or will
> the view behave as a non-indexed table? Should I take in account a lack of
> performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>
>|||Pieter,
> Will these indexes speed up a query when doing a Select on the View?
The answer is "it depends". i.e., what columns are you asking for? what
rows? do the index(es) match the row criteria? are the columns highly
selective? etc.. etc...
If the optimizer determines that an index(es) can assist in accessing the
data from the underlying tables when the view is queried, then the optimizer
will likely use the index(es). Use the Display Estimated Execution Plan
(Ctrl+L) to determine the predicted access method.
Creating an index on a view (clustered) will make a copy of the data. This
approach is useful when the underlying data does not change very often and
aggregates are involved.
HTH
Jerry
"Pieter" <pietercoucke@.hotmail.com> wrote in message
news:Olj4WGX2FHA.2436@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or
> will the view behave as a non-indexed table? Should I take in account a
> lack of performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>|||Ok thanks a lot for the info!
One more question: In the enterprise Manager the option "All Tasks" ->
"Manage Indexes" is disabled when right-clicking on the View. Is the only
way to manage indexes on a View via the query analyzer?
"Chandra" <chandra@.discussions.microsoft.com> wrote in message
news:EFC3D7B8-44AE-4721-9875-9EFF46F72190@.microsoft.com...
> Hi Pieter
> Views are virtual tables and they are not actual tables. When you try to
> query a view, u will actually be executing a query.
> The query will use the same indexes that a table is using.
> However u can create an index on views, creating an index on a view will
> effect that query only and not the main table
> please let me know if u have any questions
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://www.SQLResource.com/
> ---
>
> "Pieter" wrote:
>> Hi,
>> I have a View, which is actually a Union of some joins of some Tables.
>> All
>> these Tables have indexes.
>> Will these indexes speed up a query when doing a Select on the View? Or
>> will
>> the view behave as a non-indexed table? Should I take in account a lack
>> of
>> performance when using the view?
>> any answers, explanations, workarounds for this are welcome!
>> Thanks a lot in advance,
>> Pieter
>>

Does a View of an Indexed Table has a View?

Hi,
I have a View, which is actually a Union of some joins of some Tables. All
these Tables have indexes.
Will these indexes speed up a query when doing a Select on the View? Or will
the view behave as a non-indexed table? Should I take in account a lack of
performance when using the view?
any answers, explanations, workarounds for this are welcome!
Thanks a lot in advance,
PieterPieter wrote:
> Hi,
> I have a View, which is actually a Union of some joins of some
> Tables. All these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View?
> Or will the view behave as a non-indexed table? Should I take in
> account a lack of performance when using the view?
Indexes are used if appropriate for your query criteria. You can see this
by looking at the execution plan with QA.
Kind regards
robert|||Hi Pieter
Views are virtual tables and they are not actual tables. When you try to
query a view, u will actually be executing a query.
The query will use the same indexes that a table is using.
However u can create an index on views, creating an index on a view will
effect that query only and not the main table
please let me know if u have any questions
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"Pieter" wrote:

> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or wi
ll
> the view behave as a non-indexed table? Should I take in account a lack of
> performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>
>|||Pieter,

> Will these indexes speed up a query when doing a Select on the View?
The answer is "it depends". i.e., what columns are you asking for? what
rows? do the index(es) match the row criteria? are the columns highly
selective? etc.. etc...
If the optimizer determines that an index(es) can assist in accessing the
data from the underlying tables when the view is queried, then the optimizer
will likely use the index(es). Use the Display Estimated Execution Plan
(Ctrl+L) to determine the predicted access method.
Creating an index on a view (clustered) will make a copy of the data. This
approach is useful when the underlying data does not change very often and
aggregates are involved.
HTH
Jerry
"Pieter" <pietercoucke@.hotmail.com> wrote in message
news:Olj4WGX2FHA.2436@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a View, which is actually a Union of some joins of some Tables. All
> these Tables have indexes.
> Will these indexes speed up a query when doing a Select on the View? Or
> will the view behave as a non-indexed table? Should I take in account a
> lack of performance when using the view?
> any answers, explanations, workarounds for this are welcome!
> Thanks a lot in advance,
> Pieter
>|||Ok thanks a lot for the info!
One more question: In the enterprise Manager the option "All Tasks" ->
"Manage Indexes" is disabled when right-clicking on the View. Is the only
way to manage indexes on a View via the query analyzer?
"Chandra" <chandra@.discussions.microsoft.com> wrote in message
news:EFC3D7B8-44AE-4721-9875-9EFF46F72190@.microsoft.com...[vbcol=seagreen]
> Hi Pieter
> Views are virtual tables and they are not actual tables. When you try to
> query a view, u will actually be executing a query.
> The query will use the same indexes that a table is using.
> However u can create an index on views, creating an index on a view will
> effect that query only and not the main table
> please let me know if u have any questions
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://www.SQLResource.com/
> ---
>
> "Pieter" wrote:
>

Friday, February 17, 2012

Document Map not appearing in Web Application

I have designed a report and everything is fine except when I view it in my vb.net application. When I view the report through the normal Reporting Services portal my document map appears fine without issue. However when I run it through my application the document map does not appear and the button is not available.

Here is the setup

I have a sql table that stores

* ReportID
* Title
* Keywords
* Serverpath

I then have an aspx page that simply has the webform report viewer with the following code. So I have a data grid populated from the reportinfo table with a Link on each title that passes the ServerPath to the reportviewer page. The URL that is genereated after I recently added the commands to the end of my report path through suggestion of another forum and that still didn't resolve the issue. Anyone out there have any suggestions on how to get the document map to show in the reportviewer webform?

The only thing I can think of is it has 3 parameters is there something special I am missing?

URL Genereated

http://perfectassistant.director-software.com/adminpages/reports/reportviewer.aspx?Path=/PAData/Student%20Information/Member%20Ensemble%20Listing%20Report&rc:Toolbar=True&rc:DocMap=true&rc:Area=Report

Page Load Code

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Dim rptPath As String

rptPath = Request("Path")

Dim rs As New ReportingService

ReportViewer1.ServerReport.ReportServerCredentials = New ReportViewerCredentials("USERNAME", "PASSWORD", "")

ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://SERVERNAME.com/reportserver")

ReportViewer1.AsyncRendering = False

ReportViewer1.ShowDocumentMapButton = True

ReportViewer1.DocumentMapCollapsed = False

ReportViewer1.ServerReport.ReportPath = rptPath

End If

End Sub

Document Maps don't show when you have the HTML viewer control set to AsyncRendering=false.

See this article for an explanation why (it has to do with the fact that we don't use frames):

http://msdn2.microsoft.com/en-us/library/ms252090.aspx