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 |
|
sross81
Posting Yak Master
228 Posts |
Posted - 2008-10-31 : 10:50:10
|
| Hello,I have a table called Triggers that has has a column called field. In this column there is text like this:Triggers: (not all columns but the ones that I need to work with)Template_id,Field50,Lab_master_.PT_PTT50, Lab_master_.T3_total_dx50, Lab_Master_.T3_update1There are a whole bunch of different fields all varying in length but they all have Lab_master_ in front of the (.) What I want to be able to do is update just the word Lab_master_ with CHC_Lab_Master_ but leave the rest after the (.) as is. Is there a way to do this?Update TriggerSet Field = CHC_Lab_Masterwhere template_id = 50 and field = 'Lab_master_%'I am not sure how to do it since there are extra values that don't need to be updated in the field name??Thanks in Advance!Sherri |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-31 : 10:53:03
|
| [code]Update TriggerSet Field =STUFF(Field,1,CHARINDEX('.',Field)-1,'CHC_Lab_Master')where template_id = 50 and field like 'Lab_master_%'[/code] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-31 : 10:53:45
|
| Update TriggerSet Field = replace(Field,'Lab_master_ ','CHC_Lab_Master_')where template_id = 50 and field like 'Lab_master_%'MadhivananFailing to plan is Planning to fail |
 |
|
|
sross81
Posting Yak Master
228 Posts |
Posted - 2008-10-31 : 11:06:35
|
Thanks this works. :)quote: Originally posted by visakh16
Update TriggerSet Field =STUFF(Field,1,CHARINDEX('.',Field)-1,'CHC_Lab_Master')where template_id = 50 and field like 'Lab_master_%'
Thanks in Advance!Sherri |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-31 : 11:07:47
|
Cheers |
 |
|
|
|
|
|
|
|