If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dynamic Coloumn update

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-10, 09:33
vinoth_padha vinoth_padha is offline
Registered User
 
Join Date: Jun 2010
Posts: 1
Dynamic Coloumn update

Hi,
I need a help , I have a requirement as follows:

Update Table1
set Field1 = :Field1-Value,
Field2 = :Field2-Value,
Field3 = :Field3-Value
Where Field4 = '1234'.

Here I need to update Field3 only if Field3-Value is > spaces. If it is spaces
I should not update this Field in the Sql. Please let me know if there is any way to do this.
Reply With Quote
  #2 (permalink)  
Old 06-25-10, 09:59
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
how about a CASE statement when field3-value > '' then field3-value else filed3?
Dave
Reply With Quote
  #3 (permalink)  
Old 06-25-10, 10:02
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,195
Quote:
if Field3-Value is > spaces
???
What data types are Field3 and Value?

Anyway, you can use CASE expression.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On