Home Forums SQL Server 2008 T-SQL (SS2K8) Sql Query - get most recent data and put record numbers into columns RE: Sql Query - get most recent data and put record numbers into columns

  • CELKO (11/26/2012)


    You might also want to learn the ANSI row constructor syntax for INSERT INTO:

    INSERT INTO Readmits

    (mr_nbr, birth_date, first_name, last_name, discharge_timestamp)

    VALUES

    ('SHL295834', '1955-09-12', 'JK', 'Aaron', '2011-05-03 20:56:00'),

    ('SMC101149', '1955-09-12', 'JK', 'Aaron', '2011-11-07 20:50:00'),

    ('SSC101149', '1955-09-12', 'JK', 'Aaron', '2011-12-22 18:00:00');

    Or not. It's not portable to versions/engines that don't follow that particular ANSI standard which would also discourage people using an older version of SQL Server from helping. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)