-1

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.)

1 Answers1

2

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.

makciook
  • 1,537
  • 10
  • 19
  • I figured that is how it worked but I don't like to assume... Thanks for confirmingand I was able to find that on MSDN now becuase of your post. Thank you. – Michael Millhouse Jul 08 '13 at 15:01