Question

I have a simple problem in Advantage Database SQL.

I have dates in the format M/D/YYYY and want to convert them MM/DD/YYYY. Normally in SQL Server I would just use a convert(varchar(20), field, 101) but this does not work in Advantage.

What is the format for doing so?

Was it helpful?

Solution

I don't believe there is a simple conversion function like that available. To convert it directly in SQL would probably turn into a fairly messy statement (I think it would require a combination of CONVERT, YEAR, DAY, and MONTH scalars).

If the goal, though, is to force the display of date values in a specific format in the client application, then one possibility might be to specify the date format at connection time. How you do that depends on the client being used. If, for example, you are using a connection string, then you may be able to specify the date format as follows.

Data Source=\\server\share\yourdatapath;...;DateFormat=MM/DD/YYYY;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top