Link to home
Start Free TrialLog in
Avatar of nkendrick
nkendrick

asked on

Error trying to CAST a timestamp with sun ODBC-JDBC bridge and ireport

Hi,

I am trying to make a unique (but repeatable) reference by concatenating a string with a timestamp as part of an Access 97 query via the Sun ODBC-JDBC connector wit iReport:

tbl_PET_Pet.Pet_Time_Updated + tbl_PET_Pet.PET_Pet_Reference as uniqueid

The report complains that the textfield cannot be cast from a timestamp to a string so I have tried various permutations in the query, such as:

cast (tbl_PET_Pet.Pet_Time_Updated as varchar(20)) + tbl_PET_Pet.PET_Pet_Reference as uniqueid,

But the query won't build - Missing Operator.

Am I getting the syntax wrong for an ODBC query?

Any ideas?

Thanks
Avatar of JimFive
JimFive
Flag of United States of America image

A timestamp is equivalent to a binary(8) column.  So you most likely have to convert it to a number first.

CAST(CAST(tbl_PET_Pet.Pet_Time_Updated as bigInt) as varchar(20)) + tbl_PET_Pet.PET_Pet_Reference as uniqueid
Avatar of nkendrick
nkendrick

ASKER

Thanks but that still gives the same error message.
I think you need to past the entire query.

Also, what is the backend database server?
ASKER CERTIFIED SOLUTION
Avatar of nkendrick
nkendrick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial