tsql multiple rows select statement

  • hi

    i need some help,i have a table and i want to check a condition if this happen i want to insert to other table based on the id from the first table and i want also to do calculations.

    in sql we used to take the result of select statement and read them sqlreader but in tsql how can i get the information of each rows and put them in variables to do calculations?

    i see cursor but i don't know how does it work and if i can use it to select more than one field

    and how

    please i need help

    thnx

  • Pretty straight forward concept, but we'll need sample data and schema to really help out here. From a high level perspective, here's what you'll need.

    INSERT INTO DestinationTableName(Col1, Col2, Col3)

    SELECT Col1,

    Col2,

    SomeCalcOnColumn3

    FROM SourceTable

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

Viewing 2 posts - 1 through 2 (of 2 total)

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