Home All Groups Group Topic Archive Search About
Author
16 Sep 2005 2:05 AM
Chris
Given this simple table:
start_date
end_date
event

And this single record:
9/28/2005
10/2/2005
Conference

Can I get this recordset?
9/28/2005    Conference
9/29/2005    Conference
9/30/2005    Conference
10/1/2005    Conference
10/2/2005    Conference

Author
16 Sep 2005 6:12 AM
Jens
DECLARE @StartDate datetime
DECLARE @EndDate datetime
DECLARE @Type varchar(50)

SET @StartDate = '9/28/2005'
SET @EndDate = '10/2/2005'
SET @Type = 'Conference'

Create Table #Temp
(
        Appointmentdate datetime,
        AppointmentType varchar(50)
)

While @startdate <= @EndDate
BEGIN
        INSERT INTO #Temp
        Select @StartDate,@Type

        SET @StartDate = DATEADD(dd,1,@StartDate)
END

Select * from #temp

HTH, Jens Suessmeyer
Author
16 Sep 2005 8:32 AM
Jose G. de Jesus Jr MCP, MCDBA
hi chris,
kindly try this script


use northwind
declare @date1 as  datetime,@date2 as datetime,@orderid varchar(200)
select top 1 @orderid=orderid, @date1=orderdate,@date2=shippeddate from orders
while datediff(dd,@date1,@date2)<>0
begin
select @orderid as orderid,@date1 as shippeddate
select @date1=DATEADD(dd,1,@Date1)
end


--
thanks,

------------------------------------
Jose de Jesus Jr. Mcp,Mcdba
Data Architect
Sykes Asia (Manila philippines)
MCP #2324787


Show quote
"Chris" wrote:

> Given this simple table:
> start_date
> end_date
> event
>
> And this single record:
> 9/28/2005
> 10/2/2005
> Conference
>
> Can I get this recordset?
> 9/28/2005    Conference
> 9/29/2005    Conference
> 9/30/2005    Conference
> 10/1/2005    Conference
> 10/2/2005    Conference
>
>
>
Author
16 Sep 2005 9:12 PM
Hugo Kornelis
On Thu, 15 Sep 2005 22:05:09 -0400, Chris wrote:

Show quote
>Given this simple table:
>start_date
>end_date
>event
>
>And this single record:
>9/28/2005
>10/2/2005
>Conference
>
>Can I get this recordset?
>9/28/2005    Conference
>9/29/2005    Conference
>9/30/2005    Conference
>10/1/2005    Conference
>10/2/2005    Conference
>

Hi Chris,

http://www.aspfaq.com/show.asp?id=2519

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)

AddThis Social Bookmark Button