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 |
|
FightingTiger
Starting Member
23 Posts |
Posted - 2012-05-10 : 17:13:54
|
| Is it possible to convert a string into a smaller string. Ex: Re-Indexed Document; Credit App-- is what comes back but I want to change it where it just says Ex: Credit AppHow would you do so?I got this far convert (varchar (20), tmessage, not sure where to go from here. |
|
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-05-10 : 17:22:27
|
| Here we go declare @a varchar(50)set @a = 'Re-Indexed Document; Credit App'select substring(@a,CHARindex (';',@a)+1,LEN(@a)) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-05-14 : 07:39:32
|
| When you get an error you should post the code. Is the format of data same?MadhivananFailing to plan is Planning to fail |
 |
|
|
FightingTiger
Starting Member
23 Posts |
Posted - 2012-05-14 : 10:03:40
|
| I ran the solution that was posted this morning and worked perfectly. I really appreciate the information. I also when back and tried something else as well and used a case statement to do the same thing. Case when c.itemname like '%Bill Statement%' then 'Bill Statement' when c.itemname like '%Credit App%' then 'Credit App' Else 'Other'End |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-05-16 : 04:26:49
|
| Also note that CASE is an expression and not a StatementMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|