By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,139 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,139 IT Pros & Developers. It's quick & easy.

datetime

P: n/a
Hi There,

is there any possibility to declare datetime-column with special format in
ALTER TABLE-Statement.

e.g. I run the following query in MS-Access:

ALTER TABLE table ADD Datum DATETIME;

I get an add. column with datetime but NO "Format". I need to have "short"
format (xx.xx.xxxx),
but I cannot see any chance to alter my SQL-Query in order to get this
working. The problem is,
that I cannot use any of the access-tools to declare this column "short
format" 'cause I can only
use standard sql-queries to add this column.

Hope you can help!

ON
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Oliver Neumann" <ol************@newidentity.de> wrote in message
news:bm************@ID-130774.news.uni-berlin.de...
Hi There,

is there any possibility to declare datetime-column with special format in ALTER TABLE-Statement.

e.g. I run the following query in MS-Access:

ALTER TABLE table ADD Datum DATETIME;

I get an add. column with datetime but NO "Format". I need to have "short" format (xx.xx.xxxx),
but I cannot see any chance to alter my SQL-Query in order to get this
working. The problem is,
that I cannot use any of the access-tools to declare this column "short
format" 'cause I can only
use standard sql-queries to add this column.


I can't think of any circumstance where the format property of the table
should make one whit of difference. You are aware that this has zero
affect on how the date is stored, correct? Since users should never be
exposed to the tables directly, you only need to worry about the format in
forms and reports.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #2

P: n/a
"Rick Brandt" <ri*********@hotmail.com> schrieb im Newsbeitrag
news:bm************@ID-98015.news.uni-berlin.de...
"Oliver Neumann" <ol************@newidentity.de> wrote in message
news:bm************@ID-130774.news.uni-berlin.de...
Hi There,

is there any possibility to declare datetime-column with special format

in
ALTER TABLE-Statement.

e.g. I run the following query in MS-Access:

ALTER TABLE table ADD Datum DATETIME;

I get an add. column with datetime but NO "Format". I need to have

"short"
format (xx.xx.xxxx),
but I cannot see any chance to alter my SQL-Query in order to get this
working. The problem is,
that I cannot use any of the access-tools to declare this column "short
format" 'cause I can only
use standard sql-queries to add this column.


I can't think of any circumstance where the format property of the table
should make one whit of difference. You are aware that this has zero
affect on how the date is stored, correct? Since users should never be
exposed to the tables directly, you only need to worry about the format in
forms and reports.


Ahhh, ok. Thought it would make difference on how data is stored.

Thanks.

ON
Nov 12 '05 #3

P: n/a
"Oliver Neumann" <ol************@newidentity.de> wrote in message
news:bm************@ID-130774.news.uni-berlin.de...
Hi There,

is there any possibility to declare datetime-column with special format in
ALTER TABLE-Statement.

e.g. I run the following query in MS-Access:

ALTER TABLE table ADD Datum DATETIME;

I get an add. column with datetime but NO "Format". I need to have "short"
format (xx.xx.xxxx),
but I cannot see any chance to alter my SQL-Query in order to get this
working. The problem is,
that I cannot use any of the access-tools to declare this column "short
format" 'cause I can only
use standard sql-queries to add this column.

Hope you can help!

ON


As Rick has pointed out, there isn't much point to adding the format
property - and this is why it isn't supported with the ALTER TABLE column.
However, if you really had to do this - for example, a customer looked at
the tables using Access, but couldn't work out how to do this on his own,
then I suppose you could write a small patch in vbs. Note you would have to
use DAO to get there.

Fletcher

Set eng = CreateObject("DAO.DBEngine.36")
Set dbs = eng.OpenDatabase("C:\Test\db1.mdb", True)
Set tdf = dbs.TableDefs("MyTable")
Set fld = tdf.CreateField("NewDateField", 8)
tdf.Fields.Append fld
Set prp = fld.CreateProperty("Format", 10, "ddd dd-mmm-yy")
fld.Properties.Append prp
Set prp = Nothing
Set fld = Nothing
Set tdf = Nothing
dbs.Close
Set dbs = Nothing
Set eng = Nothing
Msgbox "Done", vbInformation
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.