Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need to be able to pull a set of numbers out of a value. For example CA/1235/Name. I need to be able to select only 1235. Having some issues getting my select correct to do this. I've tried some queries using CharIndex but didn't get close. Any help would be much appreciated!
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-10-30 : 17:25:55
if the format is consistent you could use something like
SELECT LEFT(STUFF(column,1,CHARINDEX('/',Column),''),CHARINDEX('/',STUFF(column,1,CHARINDEX('/',Column),''))-1) FROM Table
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Brittney10
Posting Yak Master
154 Posts
Posted - 2012-10-31 : 15:52:51
Thanks! Just what i was needing!
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-11-01 : 09:49:08
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/