SQL Server Performance

Data loading using cursors.pl help

Discussion in 'General Developer Questions' started by gaurangpadhye, Sep 19, 2006.

  1. gaurangpadhye New Member

    Hi,
    I have a table in my DB which i need to populate using cursors or stored procedures..
    i have to load the data from certain columns from certain columns from other tables on the same database.
    eg:- i have a table A which has certain columns asst_id, asst_name, asst_nmbr, asst_desc.
    i have to populate these columns in table A with values from 2 other tables--Table B & Table C which i have on my database..eg:- asst_id i get from asst_id column from table B but asst_name i get from table C..
    Can some one help me with a general format of how do i do this using cursors or stored procedures,,its kinda urgent..any help much appreciated!!
    Thanks
    Gaurang
  2. Chappy New Member

    Im not convinced you need a cursor.

    Can't you write a query which joins the tables you need, together, to produce a single result set using JOIN ?
    If you can, you can simply INSERT INTO Table (f1, f2, f3) SELECT f1, f2, f3 from TABLE1 JOIN Table2 ON etc etc

    Post the schema of the tables, maybe we can advise

Share This Page