Find and update query In SQL

Discussion in 'Databases' started by Notting, Nov 3, 2007.

  1. #1
    In pusedo code here is what I need:

    "Search FIELD in TABLE
    IF VALUE = "0"
    THEN CHANGE TO NEW VALUE "1"



    Suggestions appreciated
    Thanks
    Notting
     
    Notting, Nov 3, 2007 IP
  2. rcollins

    rcollins Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    "Search FIELD in TABLE
    IF VALUE = "0"
    THEN CHANGE TO NEW VALUE "1"​

    <cftransaction <cflock timeout="5" throwontimeout="No" name="#session.sessionID#" type="EXCLUSIVE">
    <cfquery name="whatever" datasource="DatabaseNAME" dbtype="ODBC">
    UPDATE Tablename
    <cfif #fieldname# IS "0">
    SET fieldname='1'
    </cfif>
    </cfquery>
    </cflock>
    </cftransaction>

    this could work but im not sure because i would need more info to be able to help you properly
    if your not using a database try
    <cfif field IS "0">
    <cfset field="1">
    </cfif>
     
    rcollins, Sep 3, 2008 IP