cast char string to timestamp

Database
Highlighted
Enthusiast

cast char string to timestamp

Hi

I have a problem with a char string that I need to convert to a timestamp.

I have tried the following:

1): SELECT CAST('20110405153449' AS TIMESTAMP(6) FORMAT 'YYYYMMDDhhmiss')

2): SELECT CAST('20110405153449261873' AS TIMESTAMP(6) FORMAT 'YYYYMMDDhhmiss.ssssss')

3): SELECT CAST('2011/04/05 15:34:49.261873' AS TIMESTAMP(6) FORMAT 'YYYYMMDDhhmiss.ssssss')

4): SELECT CAST('2011/04/05 15:34:49.261873' AS TIMESTAMP(6))

number 1 is working, but my char string has 6 dicits of millisecounds.

number 2 and number 3 are not working

number 4 is working, but I would prefere to minimize the need of string manipulation.

Why are nu 2 not working?? Any help??

br

Peter Schwennesen