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 2005 Forums
 Transact-SQL (2005)
 Using a stored procedure in a Select statment

Author  Topic 

ashraff87
Starting Member

17 Posts

Posted - 2008-07-28 : 08:06:55
Hi, i want to run two stored procedures and compare the outcome of the two using EXCEPT. but to do this i beleive ill have to have them both in the form of a select statment, since putting EXCEPT inbetween my two Exec statments just doesnt work.

So how is it possible to do say the following:

SELECT * FROM (
EXEC @return_value = [dbo].[Spr]
@DATE = '12/05/2008'

)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-28 : 08:12:59
Yes, You can make a LINKED SERVER to point to yourself and use OPENROWSET, OPENDATASOURCE or similar.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-28 : 08:30:26
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Go to Top of Page

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-07-28 : 08:31:49
its better u can prefer inline function instead of stored procedure.
can u tell me the need for using a stored procedure in Select statement
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-28 : 10:32:22
quote:
Originally posted by VGuyz

its better u can prefer inline function instead of stored procedure.
can u tell me the need for using a stored procedure in Select statement


i too agree to that. UDFs have much more usability than stored procedures. they can be used select,where,.. part of statements.
Go to Top of Page
   

- Advertisement -