Not sure why you think you need to store this information; if you have a
column that has date and time information, you can derive all of these
individual components of the date at query time, using functions like
DATEPART, etc.

I did have a situation once where I was interested in things like Wednesday
vs. Tuesday (regardless of month or year), etc. You could use an index on
an integer column representing a specific portion of the date/time, and it
would usually be more efficient than an index on the datetime column itself
(depending on the query and the distribution of dates and dateparts). In
this case, assuming SQL Server, you could say:

CREATE TABLE dates
(
dt DATETIME,
d AS DAY(dt),
m AS MONTH(dt),
y AS YEAR(dt)
)
GO

INSERT dates(dt) VALUES('20030101')
INSERT dates(dt) VALUES('20030501')
INSERT dates(dt) VALUES('20030813')
GO

SELECT * FROM dates
GO

DROP TABLE dates
GO

The TIME portion, in SQL Server at least, makes no sense to separate into
its own column. You can use one of the style parameters for CONVERT to
display time only...

--
Aaron Bertrand, SQL Server MVP
[url]http://www.aspfaq.com/[/url]

Please reply in the newsgroups, but if you absolutely
must reply via e-mail, please take out the TRASH.


"Justin Kozuch" <justinkozuch@sympatico.ca> wrote in message
news:orv0b.32$2Z.12599@news20.bellglobal.com...
> Hi All,
>
> I'm developing a personal blog site and I am trying to create an archive
of
> my past blogs. I would like to have visitors view blogs based on the month
> they have been posted to the site. I understand the fundamentals of how to
> do this, in fact I can see the database setup visualized in my head.
>
> When I am creating these blogs, the current setup inserts the date and
time
> in one field in one field on the form. What code do i use to insert the
> current day/month/year/time in 4 separate fields?
>
> Thanks,
>
> Justin
>
> P.s. Hope this makes sense.
>
>