Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concat help

Status
Not open for further replies.

Weebs

Programmer
Dec 7, 2006
2
US
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'
 
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
 
Yep, that was it! Thank you very much Mirtheil.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top