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 |
atang
Starting Member
1 Post |
Posted - 2014-06-03 : 22:32:57
|
Say if I have this string "ABCD test love", is there a way I can get rid of all text after "test" so that it becomes "ABCD test". |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-06-03 : 23:11:06
|
[code]declare @str varchar(100)select @str = 'ABCD test love'select left(@str, charindex('test', @str) + 4)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-06-06 : 09:19:59
|
[code]SELECT STUFF(ColumnName,PATINDEX('% test %',ColumnName)+6,LEN(ColumnName),'') FROM Table[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|