• sa.ordekci - Wednesday, December 20, 2017 3:52 AM

    Hi. I use Sql Server 2008. 
    I have a column that is varchar. Some of values are integer valueand some of valus aer datetime value. For example, year column datas like below:
    2015
    2016
    12.4.2016
    2.2.2017
    2017 
    ....
    this field is varchar type.  want to show this column only year values like 
    2015
    2016
    2016
    2017
    2017
    .....
    .How can I control tihs?
    thanks in advance.

    if the year is always four digits and always at the end of the string....as per your sample data  then use RIGHT(<your column>,4)

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day