Your expression might be missing an ending "#" & SQL Query

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.

======= Error Message ======

The CFML compiler was processing:

An expression that began on line 27, column 99.
Your expression might be missing an ending "#" (it might look like #expr ).
The body of a cfquery tag beginning on line 20, column 2.
 
27 :        @Col_with_Pound    = @Col_with_Pound + CASE @Col_with_Pound WHEN '' THEN '#' ELSE '#,#' END + COLUMN_NAME


I tried:

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

<cfset demo_Col_with_Pound = replace(#DemoCol.Col_with_Pound#, "%", "#", "ALL")>

But, I get another error.

======= Error Message ======

The CFML compiler was processing:

an expression beginning with "replace", on line 37, column 30.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 37, column 2.
 

36 : <cfset demo_Col_with_No_Pound = DemoCol.Col_with_No_Pound>
37 : <cfset demo_Col_with_Pound = replace(#DemoCol.Col_with_Pound#, "%", "#", "ALL")>
 


How do you get around this error?  I need to use a single # in the query for the output.

thx much

 


ethanjohnsonsAsked:
Who is Participating?
 
ee_rleeConnect With a Mentor Commented:
did you just copy and pasted this? because you are missing a # at Demo.Col...

<cfset demo_Col_with_Pound = replace(DemoCol.Col_with_Pound#, "%", "##", "ALL")>

<cfset demo_Col_with_Pound = replace(#DemoCol.Col_with_Pound#, "%", "##", "ALL")>

just a thought..
0
 
ee_rleeCommented:
try to replace the 'replace' function with this

replace(#DemoCol.Col_with_Pound#, "%", "##", "ALL")
0
 
ee_rleeCommented:
or maybe this could work..

@Col_with_Pound    = @Col_with_Pound + CASE @Col_with_Pound WHEN '' THEN '##' ELSE '##,##' END + COLUMN_NAME
0
 
ethanjohnsonsAuthor Commented:
With replace with ##, I am getting:

ColdFusion was looking at the following text:
#

The CFML compiler was processing:

an expression beginning with "replace", on line 37, column 30.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 37, column 2.

 
35 :
36 : <cfset demo_Col_with_No_Pound = DemoCol.Col_with_No_Pound>
37 : <cfset demo_Col_with_Pound = replace(DemoCol.Col_with_Pound#, "%", "##", "ALL")>
 
0
 
ethanjohnsonsAuthor Commented:
oops,  thx so much for the catch
0
All Courses

From novice to tech pro — start learning today.