+ Reply to Thread
Results 1 to 1 of 1

Thread: mysql concat function

  1. #1
    the maya is offline x10Hosting Member the maya is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    11

    mysql concat function

    Hi, I'm hoping somebody out there in x10 land can help me with this problem.

    I wrote a sql statement to join several date fields together. I have to keep the year month and day separate because the dates are for arcaeological sites and mysql can't handle dates before 1.1.1000. So I have 3 fields year, month and day all integers. Then I have a BC/AD binary field. Not all of the fields are populated. In most cases only the year is available.

    I am using C# and asp.net.

    The sql code is:

    Code:
     public String dates = "select d.*, p.nameP, s.SiteName, m.nameM,"
                            + " concat (cast(ifnull(dateGRD,' ') as CHAR), ' ', case ifnull(d.dateGRM,' ') when 1 then 'January'"
                            + " when 2 then 'February'"
                            + " when 3 then 'March'"
                            + " when 4 then 'April'"
                            + " when 5 then 'May'"
                            + " when 6 then 'June'"
                            + " when 7 then 'July'"
                            + " when 8 then 'August'"
                            + " when 9 then 'September'"
                            + " when 10 then 'October'"
                            + " when 11 then 'November'"
                            + " when 12 then 'December'"
                            + " else space(1)"
                            + " end, ' ', cast(ifnull(dateGRY,' ') as CHAR),"
                            + " case ifnull(d.dateGRBCAD,' ') when 0 then 'BC' when 1 then 'AD' else space(1) end) as datefull"
                            + " from dates d"
                            + " join sites AS s on d.SiteID = s.SiteID"
                            + " left join people AS p on d.idpeople = p.idpeople"
                            + " left join monuments AS m on d.idmonument = m.idmonuments"
                            + " order by dateGRBCAD, dateGRY, dateGRM, dateGRD";
    When I run it on my PC it works well. However when I try to access the page on X! i Get the following error.

    {0} Exception caught.MySql.Data.MySqlClient.MySqlException: FUNCTION pakal_maya.concat does not exist at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00000] at MySql.Data.MySqlClient.NativeDriver.ReadResult () [0x00000]



    Any clues as to what is wrong?

    Thanks for your help.

    Got it!

    The problem was I had concat (.....) it should be concat(...) - no space between concat and parentheses. Who would have though such a small thing could cause all that hassle.
    Last edited by the maya; 01-09-2010 at 07:46 PM. Reason: Problem Fixed

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Replies: 11
    Last Post: 11-04-2009, 11:46 PM
  3. Replies: 14
    Last Post: 09-29-2008, 07:07 PM
  4. New Site-Suggestions?
    By mnoutside in forum Review My Site
    Replies: 9
    Last Post: 08-27-2008, 07:01 AM
  5. Have a problem with my forum
    By tikloos in forum Scripts & 3rd Party Apps
    Replies: 43
    Last Post: 01-19-2006, 01:14 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers