• zulmanclock (5/10/2013)


    Figured it out. Had to do some string manipulation but i got it:) Would have been easy if i wasnt working with data that came from Unix.

    SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,Cast(Field1 as varchar(10))+'/1/'

    + Case When Field2 = 'L' THEN '2012'

    When Field2 = 'T' THEN '2013' End))),DATEADD(mm,1,Cast(Field1 as varchar(10))+'/1/'

    + Case When Field2 = 'L' THEN '2012'

    When Field2 = 'T' THEN '2013' End)),101)

    from dbo.GJORHIST

    There may be a better way if you would provide us with the information needed. Your original post was vague and your second post appears to be using data from a table.