Store Procedure Issue

  • Hi All,

    I ran a sp from query analyser mode.. result came .. when i call this SP from

    application side(ASP.NET 3.0).. The following error msg came..

    Error Type:

    ADODB.RecordSet(0x800AOE78) operation is not when the object is closed.

    In that SP having cursor.. when i remove the cursor and write simple select statement. then

    execute the application.. result will caome..

    I have attached store procedure script with this forum..

    i want to remove the cursor and write in a while loop. i'm beginers..

    can anybody help me to how to write a while loop code instead of cursor with out affecting a logic.

    Urgent plz

    Thanks

    Balaji.G

  • Just a suggestion : Drop the temp table in the SP before it is getting created. like :

    IF OBJECT_ID('tempdb..#temp') is not null

    drop table #temp

    create table #temp (a int, b varchar, c xml)

  • Probably the problem is with the application. Check inside the application. As far as I know temp table will drop automatically when the session closes

  • i don't want cursor..

    how do i change this SP,with out affecting the business logic..

    if any ideas.. suggest me..

    its urgent

    Thanks

    Balaji.G

  • why don't you try

    INSERT INTO TableName SELECT Column List FROM TableName

    and get rid of the cursor

    may be you need to apply CASE for if conditions in the above select statement

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply