Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically insert julian date in a stored procedure 1

Status
Not open for further replies.

Jaminj

Technical User
Joined
Feb 19, 2005
Messages
54
Location
US
Hello. I have the following formula in a stored procedure:

set @pYTDAnnual = (((@pYTD / 76) *365) / @pStoreEmployees) * 100

Is there a way to insert the julian date minus 1 into this formula? That way it would dynamically give me the 76 w/out me having to modify this every day.
 
if by "julian date" you mean the day of year (e.g. march 17 is day of year 76), then you'll want the DATEPART function with dy part

... (((@pYTD / datepart(dy,getdate()) *365) / @pStoreEmployees) * 100


rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts May 8 2005)
 
Thank you. That worked and saved me some time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top