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 select everything in field between "-" to end.last two cars will always be state.. everything in between - and state will always be city.I need to select city and state as seperate expressionsStrings = "This is myName - New Orleans LA"Thanks
RickD
Slow But Sure Yak Herding Master
3608 Posts
Posted - 2009-08-24 : 11:44:16
Well, here's one way:
declare @txt varchar(100)set @txt = 'This is myName - New Orleans LA'select substring(@txt,charindex('-',@txt)+1,(len(@txt)-(charindex('-',@txt)+1) -2))