Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 getdate

Author  Topic 

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-20 : 18:14:19
how to select only date ?

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-20 : 18:21:13
Is there any possible in MS sql server2005
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-20 : 18:23:33
Please help me..
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-09-20 : 18:32:30
Hey..what version are you working with?

in any case

GetDate() is a datetime function.

Do you want to store data or display data

Look up CONVERT in Books online for the MANY options availale to you

SELECT CONVERT(varchar(10),GetDate(),120)

as an example



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx





Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-20 : 18:35:15
Thank you .. I got it..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-09-21 : 11:36:48

1 Do Formation at front end application
2 select dateadd(day,datediff(day,0,getdate()),0)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-21 : 11:59:03
if at all there's a way, do it at front end. changing the dates to varchar will cause problems especially when you've to do manipulations with these date values later.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2010-09-21 : 16:56:05
quote:
Originally posted by jafrywilson

how to select only date ?



SQL Server 2008 has some of the basic ANSI/ISO data types, so you can use them. Avoid the old proprietary CONVERT() or fancy proprietary temporal functions.

CAST(some_datetime AS DATE)

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-09-21 : 21:40:53
What he said

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx





Go to Top of Page
   

- Advertisement -