Need SQL formula to modify column entries

Software SQL Server 2005.

I need a Sql formula to modify a column "FormType" that has several entries "Universal Workorders" that need to be changed to "Workorders".

Thanks for your help!
dave_skyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Use the T-SQL REPLACE function to substitute fragments of text.
UPDATE YourTable
SET FormType = REPLACE(FormType, 'Universal Workorders', 'Workorders') 

Open in new window

If you "need" anything "else" either provide more "details" or let us "know".
0
dave_skyAuthor Commented:
This is what I tried in a query and it didn't execute correctly:

UPDATE [MonarchSQL].[dbo].[tblJobRecordDetail]
   SET FormType = REPLACE(FormType, 'Universal Workorders', 'Workorders')

Do I need to add some conditions?
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Define 'didn't execute correctly'.  Was there an error message?  No error message but no rows affected?

Experts here can't connect to your data source and execute it ourselves, we can't read minds, and we'd prefer you give us more details so we don't have to make a lot of guesses.
1
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Next time do us a favor and do this so we can see everything in one view
Custom Image from a Screenshot
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
2,404 rows updated means that it worked.

The query has Universal Workorders, with an 's', and the column data is Universal Workorder without the 's', so the query would not update those values.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dave_skyAuthor Commented:
Thanks for your help! I really appreciate it.
0
arnoldCommented:
Wouldn't

Update tablename set formftype='Workorders' where FormType='Universal Workorders' be a straight forward and direct response
I.e. The above will return 0 rows affected because as pointed out the. Data In the column is different than specified in the query.?
The replace inclusion reflect every row was checked. And evaluated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.