Question

I know how to create and use a linked server with in a view, but my question is does having a linked server in a view hold the connection open and use the whole time or is the linked server only accessed and used when the view is used?

I am working on creating some dashboards and would like to use views in some places but wonder what if any consequences exist with using linked servers within a view.

-Thank you

(I am using MS SQL 2008 R2 to house the views, stored procedures, etc.)

Was it helpful?

Solution

A view can be thought of as either a virtual table or a stored query. The data accessible through a view is not stored in the database as a distinct object. What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table returned by the view.

This is a quote from MSDN. Also you can find on MSDN linked server properties, which are e.g Connection and Query Timeouts.

Each time a view is meant to be shown, a proper sql is being sent to linked server, which replies with a resultset defined as a temp table unless a query timeout happens. Then connection is dropped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top