[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Julian Date in SQL Server
- Subject: Re: Julian Date in SQL Server
- From: "Blakeslee, Andy" <ALBlakeslee@HOMELOAN.COM>
- Date: Thu, 11 Feb 1999 11:04:24 -0500
The problem is that the DATEPART function is expecting a variable of type
date, and you are passing a character string. You need to use the CONVERT
function to convert your $DATE string variable into a Date. Try this:
DATEPART(DY,CONVERT(date,$DATE,12).
(You might want to verify the syntax, my SQL Server is a little rusty)
Thanks,
Andy
> -----Original Message-----
> From: Martin Chou [SMTP:martin.chou@INS.COM]
> Sent: Wednesday, February 10, 1999 8:40 PM
> To: Multiple recipients of list SQR-USERS
> Subject: Julian Date in SQL Server
>
> I am currently using the function DATEPART in this format
> DATEPART(DY,GETDATE()) to get my julian date. This actually works fine
> but I need to pass a variable in place of the GETDATE(). Thus, I am
> trying to use this syntax DATEPART(DY,$DATE). The variable type that I
> am using is $ and the variable date format is YYMMDD. Unfortunately,
> the SQR doesn't seem to like the variable. Any suggestions on why this
> doesn't work? Thanx.
>
> Martin