Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Case statemants in an SQL update query Expand / Collapse
Author
Message
Posted Thursday, May 22, 2008 5:13 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, July 28, 2008 3:57 AM
Points: 19, Visits: 54
Hi,

I wanted to know what is the syntax for using case statements in an SQL update query. We are querying an Oracle Table from SQL Server.
I can use a normal update statement but am unable to do an update with a case statement.

Post #505075
Posted Tuesday, May 27, 2008 12:06 PM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 9, 2012 8:47 AM
Points: 47, Visits: 106
Sql Server syntax for updating using a case statement:

update table_1
set Datum2=(case when datum1='1' then 'One'
when datum1='2' then 'two'
when datum1='3' then 'three'
else 'four' end)
Post #507148
Posted Wednesday, May 28, 2008 10:38 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, October 8, 2012 2:57 AM
Points: 66, Visits: 433
It is always worth to look in Oracle docs CASE Expressions

Gints Plivna
http://www.gplivna.eu


Gints Plivna
http://www.gplivna.eu
Post #507838
Posted Thursday, July 3, 2008 2:11 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, October 25, 2010 6:09 AM
Points: 1,621, Visits: 409
Hi
Check out the below link
http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/update-statement-with-case-854527

Thanks -- Vj
http://dotnetvj.blogspot.com


Thanks -- Vijaya Kadiyala
www.dotnetvj.com
SQL Server Articles For Beginers



Post #528394
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse