-
Re: SQL CASE statement for UPDATE
not sure I understand your diagram, but you use CASE when an UPDATE in the
same way as you do w/a select
--
HTH,
David Satz
Principal Web Engineer
Hyperion Solutions
{ SQL Server 2000 SP2/6.5 SP5a } { Cold Fusion 5 SP1 } { VSS }
(Please reply to group only - emails answered rarely)
-----------------------------------------------------------------
"james" <cowlibob@hotmail.com> wrote in message
news:3d1c8242$1@10.1.10.29...
>
> Ladies and Gentlemen,
> I've seen the SELECT CASE... statement, but wonder if there is a similar
> construct for the UPDATE?
>
> I'm trying to update one of two columns, based on the value of a third.
eg.
>
> here, I would like col1 to be updated
> +------+------+------+
> | col1 | col2 | col3 |
> +------+------+------+
> | 1 | 5 | col1 |
> +------+------+------+
>
> and here, I would like col2 to be updated
> +------+------+------+
> | col1 | col2 | col3 |
> +------+------+------+
> | 1 | 5 | col3 |
> +------+------+------+
>
> Is this possible in a single update statement?
>
> Thanks,
> James.
-
SQL CASE statement for UPDATE
Ladies and Gentlemen,
I've seen the SELECT CASE... statement, but wonder if there is a similar
construct for the UPDATE?
I'm trying to update one of two columns, based on the value of a third. eg.
here, I would like col1 to be updated
+------+------+------+
| col1 | col2 | col3 |
+------+------+------+
| 1 | 5 | col1 |
+------+------+------+
and here, I would like col2 to be updated
+------+------+------+
| col1 | col2 | col3 |
+------+------+------+
| 1 | 5 | col3 |
+------+------+------+
Is this possible in a single update statement?
Thanks,
James.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks