none
Substring Query..? RRS feed

  • Question

  • hi all

    in my column i hav data like this..

    YEAR

    1990-1991
    1991-1992
    1992-1993
    1993-1994
    1994-1995
    1995-1996
    1996-1997
    1997-1998
    1998-1999
    1999-2000
    2000-2001

    and i want output like this

    1990-91
    1991-92
    1992-93
    1993-94
    1994-95
    1995-96
    1996-97
    1997-98
    1998-99
    1999-00
    2000-01

    can any one guide me plzzz

    Thanks and Regards

    Friday, August 17, 2012 4:33 AM

Answers

All replies

  • You could use STUFF function something like below and get the expected result:

    SELECT	STUFF([Year], 6, 2, '') FROM Table1
    Thanks!
    • Proposed as answer by Eshani Rao Friday, August 17, 2012 5:05 AM
    Friday, August 17, 2012 4:37 AM
  • Use substring or STUFF functions to do so.

    Please click the Mark as Answer or Vote As Helpful button if a post solves your problem or is helpful!

    Friday, August 17, 2012 4:39 AM
  • Try

    SUBSTRING(YEAR,1,5)+SUBSTRING(YEAR,8,2)


    Many Thanks & Best Regards, Hua Min

    • Marked as answer by Srikanthd5 Friday, August 17, 2012 7:29 AM
    Friday, August 17, 2012 4:40 AM