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.
Author |
Topic |
Johnph
Posting Yak Master
103 Posts |
Posted - 2013-09-12 : 16:08:22
|
I have data that looks like this:CAT_2DOG_22MICE_1321MONKEY_2123TIGER_1I need the select statement to select everything before the "_"CATDOGMICEMONKEYTIGER |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-12 : 16:09:57
|
[code]SELECT LEFT(columnname,CHARINDEX('_',ColumnName + '_')-1) AS RequiredValue FROM Table [/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|