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.
| Author |
Topic |
|
aturner
Starting Member
29 Posts |
Posted - 2004-07-20 : 09:50:07
|
| I'm trying to create a database to provide online training to employees which will be done yearly on a quarterly basis. There will be a topic with scenario and question and answer provided to the user. Each question will be done on a weekly bases, i.e., July 5-9, July 12-16, July 19-23, etc. This training will be provided yearly. However, the weeks may change each year, were in 2005 the week may begin July 4-8, in so on. What is the best way to display a table that will list the month, the week, topic, scenario, questions, answer and discussion were it display the information correctly when called in an ASP.NET? Should I include the year in the table without having to display the year to the user when viewing the page for that week? If so, can you provide an example as to how to structure the table correctly that includes the fields mentioned above. Thanks in advance. |
|
|
samtoffa
Yak Posting Veteran
60 Posts |
Posted - 2004-07-20 : 11:03:53
|
| This is really more of an ASP issue than backend database. In situations where I have needed to keep track of dates along with other user input I have just dynamically generated these in the ASP code and then saved them to an appropriate 'Date' field in the answer table (I am assuming that your questions and answers will be stored in different tables).If you want to dynamically generate a date in UK format (as God intended) you could use:<% =((day (date)) & " " & (MonthName (month(date),true)) & " " & (year(date)))%>or something similar.Hope this helps. Sam |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2004-07-20 : 17:31:15
|
| How about numbering your questions/topics from 1 to 53 and using something likeSELECT datepart(wk, getdate())to determine what week you're currently in?-----------------------------------------------------Words of Wisdom from AjarnMark, owner of Infoneering |
 |
|
|
aturner
Starting Member
29 Posts |
Posted - 2004-07-20 : 17:58:32
|
| To: AjarnMarkRegarding the numbering you mentions. Does this represent the number of weeks in a year? And, how can I determine what week of what year it is looking at? |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2004-07-20 : 19:57:13
|
| Yes. The datepart command I indicated tells you what week number you are currently in since getdate() returns the current date. The range of values returned are 1 to 53 (December 26 to 31, 2004 falls in week 53 by this function).So, for example, you might use a statement likeSELECT QuestionTextFROM QuestionTableWHERE WeekNum = datepart(wk, getdate())-----------------------------------------------------Words of Wisdom from AjarnMark, owner of Infoneering |
 |
|
|
|
|
|
|
|