Skip to Content
0
Former Member
Oct 23, 2009 at 06:41 PM

Case Statement

20 Views

Hi there,

I have an object with 10 digits numbers in that as shown below. We use Sql Server 2008.

eg: 6786542341

9875642342

I have to take out the last digit of the number , which i have taken off using this formula

left(tablename.columnname,len(tablename.columnname)-1) .

But i want to include a case statement that if the number is ending with 1 then keep the number as it is but if the number is ending with 2 use left(tablename.columnname,len(tablename.columnname)-1) .

Any inputs would be appreciated.

Thanks

Abhi