Page 1 of 1

Merge date and varchar

Posted: Mon 25 Apr 2005 15:01
by HoGo
Hi!

I have one little question. I need to merge into one field: one date field and one varchar field for dataset. I try it like this:

Code: Select all

SELECT (date+name) AS logitem FROM tablename
I receive error message: unable to identify an operator '+' for types 'date' and 'character varying'. I was search for some function with I could convert date to varchar but I couldn't found it.

Than You for your help.

Re: Merge date and varchar

Posted: Mon 25 Apr 2005 20:29
by rwalrond
HoGo wrote:Hi!

I have one little question. I need to merge into one field: one date field and one varchar field for dataset. I try it like this:

Code: Select all

SELECT (date+name) AS logitem FROM tablename
I receive error message: unable to identify an operator '+' for types 'date' and 'character varying'. I was search for some function with I could convert date to varchar but I couldn't found it.

Than You for your help.
Your query should look something like this:

Code: Select all

SELECT (date::varchar || name) AS logitem FROM tablename

Posted: Tue 26 Apr 2005 06:04
by HoGo
Oh yes, thank you. I can use || ...