Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using DATEPART

Author  Topic 

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 10:53:18
I need to create a table and select statement that will allow me to post questions based upon the week within each month. The test is given quarterly. So, for example, the 1st quarter would begin in the month of August, were the first week begins on 2nd through 6th; the second week, 9th through 13th; the third, 16th through 20th, etc. This process would continue each year providing the user with a new set of questions each quarter.

I'm not sure how to use DATEPART within a SELECT/INSERT/UPDATE statement that will allow me to pull the correct question based upon month, week and year.

The initial table would have the following fields:

QuestionID int,
Topic varchar,
Scenario varchar,
Question varchar,
Answer varchar,
Discussion text

Do I need to add a datetime field in this table and set the Default Value to (getDate())? Or, create a separate table that has a range of values that returns 1 to 53 with the default value set to (getDate()) and add a foreign key from the second table to my initial table?

Help!!!

JasonGoff
Posting Yak Master

158 Posts

Posted - 2004-08-02 : 11:14:11
See reply http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=38150 and please don't cross-post !
Go to Top of Page
   

- Advertisement -