Try this.

Create procedure spGetfriday @dateobject smalldatetime AS

declare @friday smalldatetime, @daysfromfriday int
select @daysfromfriday = 6 - datepart(dw,@dateobject)
select @friday = dateadd(dd,@daysfromfriday,@dateobject)
select @friday


Bit simpler, should return Fridays date of the week of whatever date you
pass in.



-----Original Message-----
From: Tipton Josh (orl1jdt) [mailto:[EMAIL PROTECTED]] 
Sent: 24 July 2002 13:06
To: CF-Talk
Subject: RE: Sql Statement


This is what I created and it works just wondering if anyone has anything
else


declare @friday smalldatetime

set @friday = getdate()


Create_Friday:
while (datepart(dw,@friday)) <> '6'

begin
        set @friday = dateadd(d,1,@friday)
end

if(datepart(dw,@friday)) <> '6'
 begin
        goto Create_Friday
end

else
  begin
        select @friday
  end

-----Original Message-----
From: Tipton Josh (orl1jdt) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 8:01 AM
To: CF-Talk
Subject: Sql Statement


Can anyone help me with a quick SQL statement to give me Fridays date of the
current week?
 
 
Thanks,
 
Joshua Tipton



______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to