SQL Cursor – Read records from table without using Cursor

Profile: SureshGanapathy
Tags:
SQL Server
I have 2 tables (Table A & Table B).I wish to read one by one records from Table A and compare with Table B. Currently we have use cursor for this purpose. But the SQL Server is waiting on the I/O to complete after a Log block in cache is flushed from Memory to Disk.
Anybody know about alternative solution to avoid cursor. It will very helpful to me.

3 Replies to this discussion

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members reply.
  • SujeetSingh
    May be with use of CTE recursive you can achieve your goal.

    It will be helpful to find solution if you can elaborate your requirement.
    :-)
    20 pointsBadges:
    report
  • edwinjhoffer
    You can use cursor alternatives like as WHILE loop, Temporary tables, and Table variables. Look at this: http://www.dotnettricks.com/learn/sqlserver/sql-server-cursor-alternatives
    3,740 pointsBadges:
    report
  • edwinjhoffer
    You can use cursor alternatives like as WHILE loop, Temporary table, and Table variables.
    3,740 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: