cursor question

  • I am converting from an old application to a new one. The old system has a table with a field with various specialities in it (no editing) The new system has a table with the specialities in it and uses this table to validate input. I need to pick out the specialities from the rows in the old system and create the new table. If I do a select distinct I can see the various values. I assume I can set up a cursor to hold the distinct values and then insert them into the new speciality table. I keep getting the "returning more than one value" error.

    can any one help?

  • Why would you need a cursor? It sounds like a simple INSERT... SELECT DISTINCT... will do the job nicely in a single step. Avoid cursors any where and every where.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • AHAH!!! The old keep it simple trick... well I'm not falling for it!!

    Thanks - it was two in the morning, but thats no excuse for stupid

    Thanks again

    Mac

  • It heppens to us all. That second set of eyes can work wonders sometimes.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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