Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Select from Saved Query

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-01-20 : 15:58:57
Is there a way to select from a saved query in SQL like there is in Access?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-20 : 22:37:36
1. It's called a Stored Procedure in SQL Server.
2. If the stored procedure executes a SELECT statement, then you simply execute it
EXEC myStoredProc;
or even without the EXEC.

You can't join to it like you can a saved query in Access though. To do that, or to perform any other operations like sorting etc. then you'll need to insert the results into a temp table or table variable.
Go to Top of Page
   

- Advertisement -