Plug the following into your Query Analyzer. It should give you an idea of
what to do:
set datefirst 6
declare @dt DateTime
declare @dj1 DateTime
Set @dt = GetDate()
Set @dj1 = 'Jan 1, 2005'
select datepart(wk, @dt)
select datename(dw, @dt), datepart(dw, @dt)
select datepart(wk, @dj1)
select datename(dw, @dj1), datepart(dw, @dj1)
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
"Aaran76" <> wrote in message
news:1159A5B9-97C5-47EF-997B-...
>I am creating a booking system in ASP.Net with VB and a MSSQL backend.
>
> I am having problems knowing where to begin with a particular part of the
> system. Bookings can only be made in weekly multiples from Saturday to
> Saturday.
>
> The only way I can think of to do it is by manually adding the weeks into
> a
> table in the DB, but this will obviously mean that I will have to
> routinely
> update this table.
>
> Is there any way to cope with this problem programmatically? The most
> suitable solution would be to write a chunk of code that the site
> administrator can run every once in a while to automatically populate a
> table
> with the weeks (this table will need to store a Week ID and a Start
> Date)....
>
> Any ideas!!!!???? I'm stuck!!
|