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
 General SQL Server Forums
 New to SQL Server Programming
 sql queries

Author  Topic 

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-06 : 11:50:34
hi

i'm doing a hoilday database and i was wondering does anyone know how to create a query which shows the hoilday and site details that commence in the calender month that follows the current month.

thanks

jessica

Ifor
Aged Yak Warrior

700 Posts

Posted - 2007-12-06 : 12:24:16
[code]DECLARE @NextMonthStart datetime
SET @NextMonthStart = CONVERT(char(6), DATEADD(m, 1, GETDATE()), 112) + '01'[/code]
SELECT *
FROM YourTable
WHERE HolidayStartDate >= @NextMonthStart
AND HolidayStartDate < DATEADD(m, 1, @NextMonthStart)
[/code]
Go to Top of Page

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-09 : 09:40:40
hi

thank you i'll try that

thanks

jessica
Go to Top of Page
   

- Advertisement -