> I have a sql query (SQL Server 2000) for CFMX:
> 
> SELECT @Col_with_No_Pound = @Col_with_No_Pound + CASE
> @Col_with_No_Pound WHEN '' THEN '' ELSE ',' END + COLUMN_NAME,
>        @Col_with_Pound    = @Col_with_Pound + CASE @Col_with_Pound
> WHEN '' THEN '#' ELSE '#,#' END + COLUMN_NAME
> .....
> 
> Obviously, # is causing the error whereas I need to # sign there.

Right, because # is used to indicate variables in CF... And of course
because CF automatically evaluates variables in quoted values like when
you're setting a string variable with a cfset tag, that's why you got
the other error when you switched to trying to use replace() to swap out
the % for #. But CF also automatically evaluates variables inside of
cfquery tags because it's assumed that you'll want to use variables in
your queries (very rarely is this not the case). So what you need is to
escape the # signs so that CF treats it as a literal string instead of
trying to evaluate a variable. In ColdFusion those characters are
escaped by doubling them (same with single and double-quotes), so in
your case this should give you the result you want:

WHEN '' THEN '##' ELSE '##,##' END + COLUMN_NAME

And this also applies to your cfset tag in the other message. 

hth,
ike



-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 503.236.3691

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:297546
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to