Re: putting the results of a stored procedure into a cursor... is it possible?

hkvats_1999_at_yahoo.com
Date: 06/25/04


Date: 25 Jun 2004 02:57:37 -0700

Instead of Stored Procedure you need careate User-Defined-Function,
which returns table type.... after that.... you need to create cursor
in following way......

declare GetData cursor for
         SELECT * FROM dbo.GetCustomers()

Regards
Hari Sharma....
Sr. Consultant...
Database

"Jigh" <folkens.jason@acd.net> wrote in message news:<JtSdnRHydu7tvyDdRVn-iQ@giganews.com>...
> I suppose I can do that... I didn't realize that sp_helptext worked with
> system stored procedures.
>
> Thanks for pointing that out bb_43 :-)
>
>
> <bb_43@hotmail.com> wrote in message
> news:l58vc.77443$Qh7.49237@newssvr25.news.prodigy.com...
> > In article <7-6dnfhEfpeCbCHdRVn-hA@giganews.com>, "Jeigh"
> <folkens.jason@acd.net> wrote:
> > >I wanna do something like this:
> > >
> > >declare GetData cursor for EXEC sp_helpindex 'customers'
> > >open GetData
> > >fetch from GetData into @index_name
> > >while @@fetch_status == 0
> > >begin
> > > -- rebuild the index and run dbcc showcontig on it
> > > fetch from GetData into @Index_name
> > >end
> > >
> > >
> > >
> > >This errors because Im trying to store the results of a SP into a
> cursor...
> > >does anyone know how I can get around this limitation? I'veb even tried
> > >using OPENQUERY using the local server as a linked server and it
> complains
> > >about something else... "the object has no columns"
> > >
> >
> > Why not simply deconstruct the sp and take the parts you want?



Relevant Pages

  • Re: How to create a user in MSDE?
    ... Look at the sp_grantdbaccess stored procedure ... Best Regards ... Yanick ... > I need to know how to create a user in MSDE. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Inserting Nulls into a Dataset
    ... Think your reply got lost. ... to null using the SetNull method. ... stored procedure. ... Regards ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Performance issues with stored procedure
    ... > stored procedure especially 'Cach insert' event to make sure that a query ... >> The proc is not very advanced, it involves creating a temp table, filling ... A couple of UDF's are used when filling the temp table. ... >> Regards, ...
    (microsoft.public.sqlserver.server)
  • Re: Select Statement: Join vs Inner Select
    ... Talking about stored procedure, there is concern about the exposure of the ... > will have to prepare an execution plan for each call. ... > this as a stored procedure and call the stored procedure from your app. ... >> Regards, ...
    (microsoft.public.sqlserver.programming)
  • Re: "Must declare the scalar variable @Nickname"...
    ... sql doesn't add him and if not ... Regards. ... > Look my stored procedure: ... > I just want to verify if the username already exists.. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading