Hi there.
I played around with the concept of what you're doing, and it is sound. I built
this simple template to prove it:
<cfquery name="getbits" datasource="mydatasource">
select * from bittest
</cfquery>
<cfdump var="#getbits#">
<cfset column_string = "bool1=1,bool2=0,bool3=1">
<cfquery name="updatebit" datasource="mydatasource">
update bittest set #column_string# where id=1
</cfquery>
<cfquery name="getbits" datasource="dugzsqlblog">
select * from bittest
</cfquery>
<cfdump var="#getbits#">
and it did indeed correctly place my "set" string within the sql and execute it
properly. Which leads me to one logical conclusion about your code:
The column_string value you're building isn't sound.
Dump what you believe to be a properly build column_string, try pasting it
directly into an update statement, and see what error you get then. Better yet,
just examine it and see that it is properly formed. However you troubleshoot it
from here though, I do believe that the issue is solely with the way your
'column-string' is being constructed.
Doug :0)
> I'm trying to construct a dynamic sql server update statement on a
> table with a large number of fields, most of them type "bit". First I
> evaluate all the "yes/no" fields and convert them to 1/0. Then I
> build a string of column (field) names and values, e.g, {name of
> field1}=0, {name of field2}=1, etc., iterating through all of the
> fields for the table.
>
> Then I try to execute the query:
>
> <cfquery name="FindRequest" datasource="rhcaccesssql">
> Update Requests Set
> #column_string#
> Where RequestID =
> #FindCurrent.requestID#
> </cfquery>
>
> However, Coldfusion 6.0 bombs on #column_string#. How can I
> accomplish this?
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:282666
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4