Solved

Is there any way to run a update with Case?

Posted on 2012-03-15
2
154 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 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
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 …
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now