Skip to main content
July 6, 2008
Answered

CANCAT DB function

  • July 6, 2008
  • 2 replies
  • 1360 views
Hi,

I are trying to create a display value of FullName using the CANCAT function and I am getting the following error:

'CONCAT' is not recognized as a function or procedure.

The following is my code:

cfquery name="qArtisits" datasource="cfartgallery">
SELECT ARTISTID, FIRSTNAME, LASTNAME,
CONCAT( FIRSTNAME, ' ', LASTNAME ) AS FULLNAME
FROM APP.ARTISTS
ORDER BY LASTNAME ASC
</cfquery>

Using MySql and CF8

Any ideas!
This topic has been closed for replies.
Correct answer
why are you using "cfartgallery" as your datasource in cfquery? I'm pretty sure this is an included db sample in cf when you install it and I don't think it is a MySQL db. I think this is an Apache derby db.

Anyway, try changing the word CONCAT to a double bar character ( || ) as shown below.

<cfquery name="qArtisits" datasource="cfartgallery">
SELECT ARTISTID, FIRSTNAME, LASTNAME,
(FIRSTNAME || ' ' || LASTNAME ) AS FULLNAME
FROM APP.ARTISTS
ORDER BY LASTNAME ASC
</cfquery>

dongzky,

Thank you very much, (FIRSTNAME || ' ' || LASTNAME ) AS FULLNAME worked like a charm!

Yes, the CFartgallery is a MySql db... I had to install MySql and create the db for the course that I am taking.

Again, thank you very much for your help!

2 replies

Inspiring
July 7, 2008
why are you using "cfartgallery" as your datasource in cfquery? I'm pretty sure this is an included db sample in cf when you install it and I don't think it is a MySQL db. Are you sure or have you checked if this is pointed to a MySQL db?
Inspiring
July 6, 2008
whichever db you are using (is it ms access or apache derby?), it does
not support CONCAT function.
check the db reference for correct syntax to use.
in some dbs string concatenation is done using & operator (i.e. SELECT
(string1 & " " & string2) AS some_alias), in others the operator is +,
while others have yet another operator...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
July 7, 2008
Azadi,

I am using MySql 5.O on Windows XP and I am running CF8 server. I an working on the ColdFusion 8 Essential Training that is on Lynda.com. I am following along with the exercises but can't seem to get it to work.

I checked the MySql documentation and CONCAT function is listed so the only thing I can think of is has to with CF8 server install (MAYBE!)

I was just hoping someone else had the same problem and could point me in the right direction.

Thanks for responding!
Inspiring
July 7, 2008
why are you using "cfartgallery" as your datasource in cfquery? I'm pretty sure this is an included db sample in cf when you install it and I don't think it is a MySQL db. I think this is an Apache derby db.

Anyway, try changing the word CONCAT to a double bar character ( || ) as shown below.

<cfquery name="qArtisits" datasource="cfartgallery">
SELECT ARTISTID, FIRSTNAME, LASTNAME,
(FIRSTNAME || ' ' || LASTNAME ) AS FULLNAME
FROM APP.ARTISTS
ORDER BY LASTNAME ASC
</cfquery>