Ask a Question related to ASP Database, Design and Development.
-
Aaron Bertrand [MVP] #1
Re: Blog Site
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...of> Hi All,
>
> I'm developing a personal blog site and I am trying to create an archivetime> 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> 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.
>
>
Aaron Bertrand [MVP] Guest
-
Accessing my blog
Contribute connects perfectly to our websites, but when I try to connect to our blog that we have hosted on our server with Wordpress, I cannot find... -
Blog not showing
I connect to several blogs. One of them shows the blog template in the editor window so that it looks as if I'm working directly on the website.... -
new cfchart blog
Hi All I'm starting a new blog on CFCHART. Check it out - http://cfchart.blogspot.com Prayank -
(OT): Can someone tell me what a BLOG is?
I see them everywhere and although I know many acronyms and even looked this one up on: http://www.acronymsearch.com/index.php I couldn't find what... -
Ruby AI Blog
The Ruby AI Weblog for implementing artificial intelligence is at http://mentifex.virtualentity.com/ruby.html -- with Ruby AI links. A.T. Murray...



Reply With Quote

