If I delete the row then I break the joins in the database.  So I want to blank 
the data out rather then remove the entire row.

Thanks for the code.  I forgot about the columnlist attribute on the query.

There is probably a better way of setting up the database so don't have to 
worry about this, but im not the guy that made the database.



-----Original Message-----
From: Mark Kruger [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 04, 2008 10:58 AM
To: CF-Talk
Subject: RE: sql clear data

Chad,

Well you could do something like this:


<!---  get list of coloumns --->
<cfquery name="blankquery" datasource="myDsn">
        SELECT * FROM mytable
        WHERE  id = -99
</cfquery> 

<cfquery name="update" datasource="myDSN">
        update myTable
        <cfloop list="#blankquery.columnlist#" index="lItem">
                <cfif lItem IS NOT 'id'>
                        #lItem = '',
                </cfif>
        </cfloop>
        1 = 1
        WHERE ID = #someIdNumber#
</cfquery>


..... Of course you would need loop to wrap around the update to determine the
Ids of the rows you wish to blank out.


Why would you need to do this?

-Mark


-----Original Message-----
From: Chad Gray [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 04, 2008 9:48 AM
To: CF-Talk
Subject: sql clear data

Is there anyway to clear the data in a row in a database without using 

UPDATE table
SET foo = '',
    Moo = '',
    Goo = ''
WHERE ID = 1

I don't want to clear the ID just the other fields.

My table has 50 fields and I don't feel like typing out all of them and
setting them to blank.








~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295842
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to