Hi,
I need to get just the date part from getdate(), eg I need to test for dDate
> getdate() but the RHS should be today 12am.
What's the correct function for this?
Cheers,
NEILSee CONVERT function in SQL Server Books Online.
Anith|||Neil,
See function "convert" in BOL.
Example:
select convert(char(8), getdate(), 112)
go
AMB
"Neil Jarman" wrote:
> Hi,
> I need to get just the date part from getdate(), eg I need to test for dDa
te
> What's the correct function for this?
> Cheers,
> NEIL
>
>|||Hi Neil,
how about DATEDIFF, then? It's not the fastest function, but if you
need to convert it anyways...
SELECT ... FROM ... WHERE DATEDIFF(dd, dDate, GETDATE()) > 0
Should do the trick.
HTH,
Pierre
/"\ ASCII Ribbon Campaign
\ /
X Against HTML
/ \ in e-mail & news|||This should give you a good understanding about the datetime datatypes in SQ
L Server.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Neil Jarman" <neil@.tNOiSPAMvPLEASEy.co.uk> wrote in message
news:dij758$c9c$1$8302bc10@.news.demon.co.uk...
> Hi,
> I need to get just the date part from getdate(), eg I need to test for dDa
te
> What's the correct function for this?
> Cheers,
> NEIL
>|||Great!
Just what I needed.
Many thanks,
NEIL|||Perhaps I should post the link as well...
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message
news:%2396LM2zzFHA.460@.TK2MSFTNGP15.phx.gbl...
> This should give you a good understanding about the datetime datatypes in
SQL Server.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Neil Jarman" <neil@.tNOiSPAMvPLEASEy.co.uk> wrote in message
> news:dij758$c9c$1$8302bc10@.news.demon.co.uk...
>|||A helpful site.
Many thanks for this Tibor!
Neil
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment