[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Sybase SQL update column with pattern

Posted on 2011-10-24
Medium Priority
Last Modified: 2012-05-12

I want to update a table use a pattern for example:

update products set productid = "productid/productid" where productid =  "productid-productid

Is that possible?

From example:
id, productid,price
1, 100-1,1

To example:
id, productid,price
1, 100/1,1

Question by:africanw
1 Comment
LVL 24

Accepted Solution

Joe Woodhouse earned 2000 total points
ID: 37023735
You don't tell us which Sybase database product or version you're using, which is a problem because the answer will be different depending on which you're using.

Assuming you are using Sybase ASE with version at least, this is easy:

update products
set       productid = str_replace(productid, "-", "/")
where  productid like "%-%"

If your products table is very large you may need to batch this into smaller updates to avoid filling your transaction log.

If you're using a different version of ASE, or you're not using ASE, let us know as the answer will probably have to change.

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question