Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is there any way to run a update with Case?

Posted on 2012-03-15
2
Medium Priority
?
172 Views
Last Modified: 2012-03-15
Hello Guys,

I have an update script:

update product set price_sell = 123.45 where code=45

Open in new window


the problem is that I need to create a script with price_sell diferent when I am in a determined table, for example:

update product set price_sell = case database='viadiesel' then 123.45 else 187.74 end if where code=45

Open in new window


how can I do that? Is it possible?

thanks
Alexandre
0
Comment
Question by:hidrau
2 Comments
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 37725084
yep, you just missed the WHEN:

update product set price_sell = case when database='viadiesel' then 123.45 else 187.74 end  where code=45
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 37725119
thanks
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

824 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