Home Forums SQL Server 2008 T-SQL (SS2K8) CONCATINATE 3 COLUMNS (int) INTO A WORKABLE DATE FORMAT RE: CONCATINATE 3 COLUMNS (int) INTO A WORKABLE DATE FORMAT

  • personally, since you have integers, i'd stick with using the dATEADD() functions:

    /*

    2012-02-01 00:00:00.000

    2012-03-01 00:00:00.000

    2012-04-01 00:00:00.000

    */

    CREATE TABLE PS_TestForOnline

    (

    DAY_ INT,

    MONTH_ INT,

    YEAR_ INT

    );

    INSERT INTO PS_TestForOnline

    VALUES(1,1,2012);

    INSERT INTO PS_TestForOnline

    VALUES(1,2,2012);

    INSERT INTO PS_TestForOnline

    VALUES(1,3,2012);

    SELECT DATEADD(dd,DAY_ -1,

    DATEADD(mm,MONTH_ -1,

    DATEADD(yy,(YEAR_ - 1900) ,0))),

    * FROM PS_TestForOnline

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!