OPENROWSET

sundar k replied to bretto kumar A at 06-Jul-08 01:39

what you can do is - you can execute a stored procedure in a query using OPENROWSET option and can change your query as,

select top 3 newsid from staff s,
OPENROWSET('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;','set fmtonly off exec master.dbo.spu_SdOtherNews')
AS a
where
s.id <> a.id
order s.id desc

Assuming spu_SdOtherNews is in Master databawse and it returns the list of ids.


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  store procedure - bretto kumar A  05-Jul-08 08:46 8:46:19 AM
      Go For Select Query - Sanjay Verma  05-Jul-08 09:13 9:13:44 AM
      Try cursor - Sujit Patil  05-Jul-08 09:20 9:20:00 AM
      I just went through this - Jason S  05-Jul-08 09:31 9:31:51 AM
      Re : Store Procedure - Ashutosh Dhok  05-Jul-08 10:44 10:44:20 AM
      ans to sp - Umapathy Kaliaperumal  06-Jul-08 08:03 8:03:14 AM
      OPENROWSET - sundar k  06-Jul-08 01:39 1:39:34 PM
      Yes u can execute sp within sp - Arvind Kumar  07-Jul-08 01:12 1:12:21 AM
View Posts