SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 reverse substr extract 2 digits or chars from righ
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cplusplus
Aged Yak Warrior

537 Posts

Posted - 12/27/2012 :  17:44:48  Show Profile  Reply with Quote
Can you please provide reverse sub string capturing from right 2 charecters/digits:

it can be 5 digit or 6 digit data, want to capture the right side 2 digits.

example: 72509
123110

after extract: it should be: 09 , 10

Thank you very much for the helpful info.

Edited by - cplusplus on 12/27/2012 17:48:03

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 12/27/2012 :  18:05:36  Show Profile  Reply with Quote
You can just grab the last 2
SELECT RIGHT(digits,2) or if digits is a number
SELECT RIGHT(convert(varchar(6),digits),2)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000