|
Posted by Lucky on 06/23/06 07:18
Hi ,
Here i'm pasting the sql code that i want to run. the code is ment to
fetch datbase list and update each database with some specific business
logic.
DECLARE authors_cursor CURSOR FOR
SELECT sp_databases
OPEN authors_cursor
FETCH NEXT FROM authors_cursor
INTO @Database_name, @database_size, @Remarks
WHILE @@FETCH_STATUS = 0
BEGIN
print 'database : ' + @Database_name
print 'some business logic'
FETCH NEXT FROM authors_cursor
INTO @au_id, @au_fname, @au_lname
END
CLOSE authors_cursor
DEALLOCATE authors_cursor
NOTE:
please notice the use of procedure to get list of the database in the
select statement of the DECLARING CURSOR. i want to use stored
procedure's o/p to iterate through the rows returned by the procedure.
Please let me know if you know how to do this.
thanks
Madhivanan wrote:
> Post your exact requirement. There can be better method of what you are
> trying to do now
>
> Madhivanan
>
>
> Lucky wrote:
> > Hi guys!
> > i want to create one cursor in the t-sql. the problem is i want to use
> > stored procedure instead of select command in cursor.
> >
> > can anyone tell me how can i use stored procedure's o/p to create
> > cursor?
> >
> > i'm using sql 2000 and .net 2.0
> >
> > thanks,
> >
> > Lucky
Navigation:
[Reply to this message]
|