×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Concat help

Concat help

Concat help

(OP)
I'm currently trying to make an easy script that will concatenate a date field and a time field so that I can sort by the Max of the date field. When I run the query I get a message saying that there are incompatible types in the expression. Can someone help a newbie out :) Thanks in advance.


My query is as follows: ($suffix, $wo, $seq are predefined by a form)
"SELECT concat(v_job_detail.date_last_chg, v_job_detail.time_last_chg)
          FROM   V_JOB_DETAIL
        where V_job_detail.suffix='$suffix'
        and v_job_detail.job='$wo'
        and v_job_detail.seq='$seq'"

RE: Concat help

You'll probably want to use the CONVERT function to get them into common data types. CONCAT is a string function while Dates and Times may not be strings.  You might change it to:
"SELECT concat(CONVERT(v_job_detail.date_last_chg, SQL_CHAR), CONVERT(v_job_detail.time_last_chg,SQL_CHAR))
          FROM   V_JOB_DETAIL
        where V_job_detail.suffix='$suffix'
        and v_job_detail.job='$wo'
        and v_job_detail.seq='$seq'"

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Concat help

(OP)
Yep, that was it! Thank you very much Mirtheil.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close