Alias concat column name

140 views
Skip to first unread message

Anthony

unread,
Sep 29, 2010, 5:39:00 AM9/29/10
to H2 Database
Hi Thomas

I have now began converting my vb6 with JET4 mdb app to javafx with H2
as the DB backend. I have come across two problems so for.

1/ How do I change the following statement "SELECT SURNAME & ' ' &
FORENAME AS FULLNAME FROM EMPLOYEE_DATA"

2/ How do I even achieve Alias with JDBC I have checked the doc and
not sure how to set ALIAS_COLUMN_NAME and where to set it.


I am using netbeans 6.9.1 IDE


Many thanks in advance
Anthony

Thomas Mueller

unread,
Oct 1, 2010, 2:02:00 AM10/1/10
to h2-da...@googlegroups.com
Hi

1) You need to use || instead of &:

SELECT SURNAME || '  ' || FORENAME AS FULLNAME FROM EMPLOYEE_DATA

I didn't know & can be used to concatenate text in MS Access. I will
add a feature request.

2) Alias column names: See
http://h2database.com/html/faq.html#column_names_incorrect : "If you
need compatibility with those databases, use the Compatibility Mode,
or set the system property h2.aliasColumnName."

To set a system property, see the top of the page:
http://h2database.com/javadoc/org/h2/constant/SysProperties.html

Regards,
Thomas

Anthony

unread,
Oct 3, 2010, 3:30:51 PM10/3/10
to H2 Database
Many Thanks

On Oct 1, 7:02 am, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
> Hi
>
> 1) You need to use || instead of &:
>
> SELECT SURNAME || '  ' || FORENAME AS FULLNAME FROM EMPLOYEE_DATA
>
> I didn't know & can be used to concatenate text in MS Access. I will
> add a feature request.
>
> 2) Alias column names: Seehttp://h2database.com/html/faq.html#column_names_incorrect: "If you
Reply all
Reply to author
Forward
0 new messages